Modern data processing technologies and document workflow automation require the integration of various file formats to ensure seamless interaction between software products. With its extensive capabilities, Microsoft Word has become one of the most popular text editors, suitable for a wide range of tasks.
At times, you may need to convert these documents into formats specific to other applications. For instance, there are situations where you need to convert Microsoft Word files into the FastReport .NET format, which is used for creating report templates when working with FastReport.
First, open the .sln file named FastReport.OOXMLImportPlugin.sln. Note that there are two such files for Visual Studio 2017 and above. Then, remove the references to the FastReport and FastReport.Bars projects as shown in the screenshot below.
After that, you need to add a reference to FastReport.dll. This DLL is located in the same folder as the Designer.
Right-click in the workspace and click "Build." After that, navigate to the path FastReport.OOXMLImportPlugin\bin\Debug\net472
and you will find the compiled file “OOXMLImportPlugin.dll” in that folder.
You can do this in several ways.
Open the report designer, then go to the "File|Settings..." menu in the Ribbon interface (or "View|Settings..." in the standard interface).
Next, in the "Plugins" tab, add FastReport.OOXMLImportPlugin.dll.
After that, restart the FastReport .NET designer. If you are working in the Visual Studio IDE, be sure to restart it as well. Once the designer is launched again, click "File|Open" and select "Microsoft Word Document (*.docx)" from the list of available files, as shown in the screenshot below.
Select the desired *.docx file to import into FastReport .NET. As a result, you will see the imported file in the designer.
By default, this file is located in the folder C:\DocumentsandSettings\user_name\Local Settings\Application Data\FastReport
. Make sure to close all running instances of FastReport .NET. Only after that, open the configuration file in any text editor and change it as follows:
<?xml version=«1.0» encoding=«utf-8»?> <Config> ... <Plugins <Plugin Name=«c:\.....\ OOXMLImportPlugin.dll»/> </Plugins> </Config
For this, you will need to add an "OOXMLImportPlugin.dll" reference in your project, as shown below.
Then, execute the following code once when the application starts:
FastReport.Design.DesignerPlugins.Add(typeof(FastReport.Design.ImportPlugins.OOXML.DocxImportPlugin));
First, install the NuGet packages FastReport.Net and FastReport.Plugins.OOXMLImport from our private NuGet server. Installation instructions are available at this link.
Next, you need to register the plugin using the following code:
FastReport.Design.DesignerPlugins.Add(typeof(FastReport.Design.ImportPlugins.OOXML.DocxImportPlugin));
Run the application, then click "File|Open" and select "Microsoft Word Document (.docx)."
Select the desired *.docx file to import into FastReport .NET. As a result, you will see the imported file in the designer.
As of now, our plugin does not support background highlighting of part of a line, shapes, as well as nested vector graphics (Vector Markup Language, VML), and OLE objects.
Sometimes, empty pages are added to the resulting report. If you encounter this issue, please contact our technical support at support@fast-report.com.
Thus, the developed converter from .docx to .frx is an important step in simplifying the automation of document handling processes and report generation. It significantly reduces the time required to create report templates by using ready-made Word files.
It’s important to remember that the structures of the two file formats are different and cannot just be swapped into one another. You need to take into account the file structures and adjust everything to fit the required format to ensure that the data is accurate and the formatting is preserved. For guidance on how to prepare the document so that it retains its proper structure, please refer to this material.