Search code examples
c#ms-wordreportdocumentlistlabel

How can I use Word/DOCX documents inside a report in List & Label


I have seen that it is very easy to use a PDF document in a report of List & Label. However, our users also juggle MS Word documents in everyday life and would like to be able to use these directly in a List & Label report.

Of course, I can try to convert Word files to PDF in the software first, so that you can use them again as PDF objects in the report. But is there also a simple variant that you can directly integrate a Word file in the designer of List & Label - without the conversion?


Solution

  • You have several options here:

    • you can save the Word document as formatted text (RTF) and display this in a Formatted Text object in the design. NB not all Word features are supported by RTF, especially the table support is kind of limited. There's a sample showing the usage of RTF text that can be cloned from here. The link is for .NET 4.0, there are also Core 3.1 and .NET 5 samples in the repo.
    • if Word is installed on the machine rendering the report, you can also use the OLE container object in order to display the contents of your Word document.
    • you could write your own DesignerObject that does the job if you already have a component that is capable of rendering the document. Here's a sample implementation that uses the TX Text Control, it can be redone in similar ways for other components.