Set document margins when converting html to word

3 posts, 1 answers
  1. Andrew
    Andrew avatar
    15 posts
    Member since:
    Mar 2015

    Posted 22 Aug Link to this post

    I need help setting document margins when convert html to word using the following technique.

    string html = "<p>hello world!</p>";
    HtmlFormatProvider provider = new HtmlFormatProvider();
    RadFlowDocument document = provider.Import(html);

    I tried using the following with no luck

    PageMargins = new Telerik.Windows.Documents.Primitives.Padding(30, 0, 0, 5);

    Are there any examples showing what I require?

    Thank you

    Andy

  2. Answer
    Tanya
    Admin
    Tanya avatar
    402 posts

    Posted 24 Aug Link to this post

    Hello Andrew,

    The margins of a page could be controlled through the properties of the Section element. There is more detailed information on how to set the in our documentation.

    After importing the document, you can access each of its elements using the EnumerateChildrenOfType() method. The following snippet demonstrates how to obtain the first Section in RadFlowDocument instance:
    Section firstSection = document.EnumerateChildrenOfType<Section>().First();

    Hope this is helpful.

    Regards,
    Tanya
    Telerik by Progress

  3. Andrew
    Andrew avatar
    15 posts
    Member since:
    Mar 2015

    Posted 24 Aug Link to this post

    Than you. That worked.
Back to Top