TfrxRichView and TfrxRTFexport

al_nolandal_noland Tulsa, Oklahoma
edited 7:00AM in FastReport 4.0
Background information: We use FastReports to generate patient medical documents. The reports consist of a header, body and footer. All of the data on the report/document is generated from code and isn't connected to a dataset. The header and footer are populated via parameters. The body of the report is a TfrxRichView. The text that is populated into that form comes from a word document that is saved as an RTF, and loaded via the loadfromstream command. The word document is generated with form fields in another system. Previewing, printing and exporting to PDF works great.

The problem: We have a customer that wants the documents in RTF format. I'm trying to use the tfrxRTFExport to export the document, but the exported document has several formatting errors in the TfrxRichView control. Looking at the RTF code for the exported tfrxrichview cell in the doucmnet I see where it is adding \fiN and \liN instructions to the document that don't need to be there. There is also a \saN command that if left in place spaces the text beyond the size of the control, essentially hiding the bottom portion of the text on the exported document.

Here is the raw frxrichview exported cell RTF code.

{\fi-1800\li2160\sa120\qj\fs24 \fs20 Reason for Exam:\tab PAIN, SWELLING, R/O DVT\par \fi360\sa120\qj\b ULTRASOUND OF VEINS FOR DVT:\par \li360\qj\b0 Duplex imaging of bilateral lower extremities was performed with color flow augmentation. \par \par Examination from the common femoral down to the popliteal veins shows no identifiable intraluminal filling defect. The veins compress easily. Normal venous flow and augmentation are demonstrated.\par \b\par IMPRESSION: \par \par \b0 (1)\tab No evidence of deep vein thrombosis.\par \par \par \par By XXXX X XXXX, D.O. (Radiologist)\par Electronically signed by XXXX X XXX, D.O. 06/06/2011 - 15:29:10\par \par R:hpy\\D:hpy\\T:diaclick\par }

In order for it to display correctly I have to manually change the RTF cell to the following.

{\sa120\qj\fs24 \fs20 Reason for Exam:\tab PAIN, SWELLING, R/O DVT\par \sa120\qj\b ULTRASOUND OF VEINS FOR DVT:\par \sa0\qj\b0 Duplex imaging of bilateral lower extremities was performed with color flow augmentation. \par \par Examination from the common femoral down to the popliteal veins shows no identifiable intraluminal filling defect. The veins compress easily. Normal venous flow and augmentation are demonstrated.\par \b\par IMPRESSION: \par \par \b0 (1)\tab No evidence of deep vein thrombosis.\par \par \par \par By XXXX X XXXX, D.O. (Radiologist)\par Electronically signed by XXXX X XXXX, D.O. 06/06/2011 - 15:29:10\par \par R:hpy\\D:hpy\\T:diaclick\par }


I removed the \fiN and \liN commands. I also added a \sa0 to keep it from hiding the last part of the report.

It seems like the \fiN and \liN commands are ignored in fast reports, and the report displays correctly. But when exported the commands are picked up by word and causes the text to display differently. As far as the \saN, I don't think the control is taking into account the vertical spacing when sizing the cell.

The RTF that was imported had considerably more RTF commands that were dropped (which is fine by me). Could there be an option to include the indents when exporting as well? What can be done about the \sa and cell size issue?

The example is a very short report. Some of the reports can be several pages.

Thanks for any advice on this.

Allen

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.