Header/Footer not imported from DOCX

8 posts, 0 answers
  1. Nick
    Nick avatar
    3 posts
    Member since:
    Mar 2014

    Posted 30 Dec 2016 Link to this post

    I am importing a DOCX but the header and footer is not appearing when exporting to PDF. Any ideas?
  2. Nick
    Nick avatar
    3 posts
    Member since:
    Mar 2014

    Posted 30 Dec 2016 in reply to Nick Link to this post

    Sorry - I should have included code:

     

    This gets the letter from the DOCX:

    Protected Sub LoadS13CoveringLetter()
           fileFormatProvider = New DocxFormatProvider()
           Dim fileName As String = Server.MapPath("/admin/ASTDocs/s13CoveringLetter.docx")
           fileExtension = ".docx"
           Using input As New FileStream(fileName, FileMode.Open)
               documentletter = fileFormatProvider.Import(input)     
           End Using
       End Sub

     

    I then modify some fields in the document:

    LoadS13CoveringLetter
     Dim editor1 As New RadFlowDocumentEditor(documentletter)
               editor1.ReplaceText("TENANTNAME", thisTenantName, False, True)
               editor1.ReplaceText("FLATANDBLOCKNAME", string.Format("{0} {1}",thisProperty.FlatNumber,thisProperty.BlockName ), False, True)
           editor1.ReplaceText("PROPANDSTREET",String.Format("{0} {1}",thisProperty.PropertyNumber,thisProperty.AddressLine1),false,true)
     
           editor1.ReplaceText("ADDRESS3",thisproperty.AddressLine3,False,true)
           editor1.ReplaceText("ADDTOWN",thisProperty.Town,false,true)
           editor1.ReplaceText("ADDRESSPOSTCODE",thisProperty.Postcode,False,true)

    .... more here

     

    And when the document fields have been populated I save the document as a PDF:

    Dim renderedBytes1 As Byte() = Nothing
     
            Dim formatProvider1 As IFormatProvider(Of RadFlowDocument) = New Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider()
            Using ms As New MemoryStream()
                formatProvider1.Export(documentletter, ms)
                renderedBytes1 = ms.ToArray()
            End Using

     

    RenderedBytes1 is then stored in the database.

    This all works BUT the header and footer are not shown in the document.

    Any help massively appreciated!

  3. Mihail
    Admin
    Mihail avatar
    223 posts

    Posted 04 Jan Link to this post

    Hello Nick,

    You can find the answer to your question in the duplicated ticket with ID 1081869.

    Regards,
    Mihail
    Telerik by Progress

  4. Mark
    Mark avatar
    32 posts
    Member since:
    Aug 2010

    Posted 17 Apr in reply to Mihail Link to this post

    Hi Mihail

    I am having a similar issue with headers/footers not being included in the import from a docx document.

    How can I view support ticket 1081869?

  5. Mihail
    Admin
    Mihail avatar
    223 posts

    Posted 19 Apr Link to this post

    Hello Mark,

    I am afraid you would not be able to see the ticket with ID 1081869 as it is a support thread. However, I can share with you what the problems were in this particular case.

    The first problem was with floating images in the client document, the floating images are not yet implemented when exporting to PDF format. Here is a link to the feature request: Support for floating images when exporting to PDF

    The second problem was with images inserted as Alternate Content. This feature also is not yet implemented. Here is the link to the item in our feedback portal: Add support for images defined as alternate content

    If you have a specific question for a particular document you could start a new support thread and provide the document in question. This way we will be able to investigate your scenario.

    Regards,
    Mihail
    Telerik by Progress

  6. Mark
    Mark avatar
    32 posts
    Member since:
    Aug 2010

    Posted 20 Apr in reply to Mihail Link to this post

    Hi Mihail, thanks for the info.

    The template document header does contain an image, Line shape, and page numbers. The header for the first page also differs from the rest.

    In our particular scenario we are importing a docx, replacing some text then exporting as docx or pdf depending on certain conditions.

    In either case, the headers are empty.

    When I remove these elements and just use plain text in the headers, they come through fine.

    You mentioned images are not yet supported, what about page numbers and shapes?

  7. Mihail
    Admin
    Mihail avatar
    223 posts

    Posted 25 Apr Link to this post

    Hello Mark,

    I would like to point out that inline images are supported for export to PDF format. This means that if there are floating images or images placed as an alternate content, you can convert them to inline images and they will be exported.

    I am afraid that shapes are not yet implemented which explains why they are not exported. Here is a link to a feature request in our feedback portal: Add support for shapes.

    Regarding the page number field,  this field is not supported out of the box in words processing. Here is a link to a feature request in our feedback portal: Page Numbering Fields - PAGE, NUMPAGES.
    Nevertheless, if the field code is declared only as "PAGE" without additional options, it will be exported correctly to PDF format. If this is suitable for your scenario you could iterate over all of the fields code fragments and only for the page field to replace it with the "PAGE" code. Here a link to a help article explaining how the fields are working: Fields

    I hope this information is helpful.

    Regards,
    Mihail
    Telerik by Progress

  8. Mark
    Mark avatar
    32 posts
    Member since:
    Aug 2010

    Posted 26 Apr in reply to Mihail Link to this post

    Thanks Mihail

    Images are showing up along with the page numbers now. As for the shapes I just replaced them with images

Back to Top