How to export a report to LATEX from FastReport .NET

How to export a report to LATEX from FastReport .NET

LATEX is a typesetting system, designed for the production of high-quality technical and mathematical documentation. The system also works for other documents, from simple letters to complete books. LATEX uses TEX as its layout engine.

The initial data for LATEX is a plain text file in ASCII. You can create it in any text editor. It contains the text of the document along with commands that tell LATEX how to typeset the text.

It is based on the WYSIWYM editing paradigm. It means that the user only needs to enter the data, leaving all the formatting to the program. Unlike Microsoft Word or LibreOffice Writer, where you have to manually move text around the page, in LaTeX you can just write it and it will do the rest.

Separating the content of a document from its style is one of the most convincing reasons why many people use LaTeX. This means that you can easily change the appearance of the content after writing it. Similarly, you can create one document style and use it to standardize the other files.

The possibilities of LaTeX become almost limitless with a large number of open libraries. These libraries allow users to add footnotes, draw diagrams, and more.

Save in TEX format from the designer

Let's look at this export using the Master-Detail report as an example.

A report template in the designer

 

Run the report in preview mode:

The report in preview mode

 

Now we export to the LaTeX format:

Saving to LaTeX

 

We see the window of export settings:

Export settings window

 

All settings come down to choosing report pages. Click OK and choose where to save the file. The final document will have the tex extension. We use Texmaker to display the final report.

Final file

 

Export to LATEX from code

At the beginning of the file, you must use the using directive to access the namespace, which defines the export code.

using FastReport.Export.LaTeX;

Now, we create a report and load it from a file in the right place in the program.

Report report = new Report();
report.Load("report.frx");

The next step is to prepare a report.

report.Prepare();

In the end, we create an export job and export the report to a file.

LaTeXExport export = new LaTeXExport();
report.Export(export, @"C:\report.tex");

 

Let’s sum up. The LATEX format is very convenient for print works, and FastReport exports to it without any problems.

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.
Trustpilot