RenderObject Height

Posted by: friedrich on 30 April 2020, 8:14 am EST

    • Post Options:
    • Link

    Posted 30 April 2020, 8:14 am EST

    Dear friends,

    I will place text with different font-heights in the same line in a C1PrintDocument.

    Why it is not possible to read the height or the Y-Position of a render Object as RenderArea, RenderText, RenderRichText. I tried it in thousends of variants. You ever gets the value “auto” and a value. There is a sample to get the Y position of RenderParagraph. But this did not work with RenderArea or RenderText. Otherwise I did not see, how to set the X-Position in a RenderParagraph.

    Imports C1.C1Preview

    Imports System.IO

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    MakeDoc1(C1PrintDocument1)

    End Sub

    Private Sub MakeDoc1(ByVal doc As C1PrintDocument)

    Dim rrt1 As New RenderRichText(File.ReadAllText(“D:\Test.rtf”))

    doc.Body.Children.Add(rrt1)

    C1PrintDocument1.Generate()

    Label1.Text = rrt1.Height

    Label2.Text = rrt1.Y

    End Sub

    End Class

  • Posted 1 May 2020, 4:46 am EST

    Hello Jürgen,

    X, Y, Width and Height property of the RenderObjects takes the value of Unit type and we have created a small sample which shows how to set these properties, please have a look and let us know if you have any other query regarding this.

    Regards,

    Prabhat Sharma.

    WindowsFormsApp18_Mod.zip

  • Posted 1 May 2020, 1:33 pm EST - Updated 3 October 2022, 11:57 pm EST

    Hallo Prabhat,

    your sample shows exactly my problem. The output of the console is:

    Height = auto, Width = 5cm

    5cm

    1. It did not show the height, only “auto”! Both texts are top aligned. I will write bottom aligned. What can I do to write both text bottom aligned?
    2. Also I want to get the height of a RenderRichText Object.

    Thank you for your answer

    Regards and greeting from germany

    Jürgen

  • Posted 4 May 2020, 7:52 am EST

    Hi,

    By default, the height of each RenderObject is ‘Auto’. This means that the object’s size is calculated according to its content. So you cannot get the actual height value. Please refer to following documentation link for information on RenderObject’s size and location behavior:

    https://www.grapecity.com/componentone/docs/win/online-report/specifyingrenderobje.html

    To set the alighnmemt of the text in the RenderText use the TextAlignHorz and TextAlignVert property as given below:

    rt1.Style.TextAlignHorz = AlignHorzEnum.Left;
    rt1.Style.TextAlignVert = AlignVertEnum.Bottom;
    

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels