Search code examples
c#.netwinformscrystal-reports

Crystal reports Text object control left property measurement


When i want designing report in .rpt file,i add a Text Object. I want to set the location for that by user.So i used code below :

        ReportDocument rd = new ReportDocument();
        rd.Load(Environment.CurrentDirectory + "\\CrystalReport1.rpt");
        TextObject to = ((CrystalDecisions.CrystalReports.Engine.TextObject)rd.ReportDefinition.ReportObjects["txt"]);
        to.Text = "Hello World!!!";
        to.Left= 500;
        crystalReportViewer1.ReportSource = rd;
        crystalReportViewer1.Show();

But the Left property of 'to' isn't configure by pixels.I don't know what the measurements. When i move the control in .rpt file the Left Property changes from 0 to 10920! What is this measurements?and how can i make it in cm?


Solution

  • iirc, Crystal units are TWIPS, or one twentieth of a point, and 1 twip = 1/1440 inch. They are independent of the number of pixels on the screen; to find out how many twips wide your document is, you check the page size you setup on the report (in inches let's say, then multiply by 1440). And I'm not sure you can change this programmatically.

    Anyway: if 1 inch = 1440 twips, 1 cm = 576 twips.

    Hope that helps...