FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Convert a print to Rtf or doc
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Convert a print to Rtf or doc
Posted: Wed Nov 29, 2023 12:59 PM

Hi to all

I have a print

PRINT oPrn NAME "My Print" PREVIEW

PAGE

WHILE !EOF()

some instruction like

Prn:Say( nRow, nCol , bla bla )

ENDPAGE

PAGE

ENDDO

ENDPAGE

ENDPRINT

I need some hints about the possibility to save the print into rtf for or doc You know for instance when you have a report in Access you see preview you can export in RTF. Simple but functional. Many thanks to all!

Marco Boschi
info@marcoboschi.it
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Convert a print to Rtf or doc
Posted: Wed Nov 29, 2023 04:49 PM

richedit ?? no sirve?

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 01:31 AM
I need some hints about the possibility to save the print into rtf for or doc
You can save to MSWord doc.
In the preview click "W" button or Click SaveAs and then choose "Doc format". You will see the document in MSWord,
Then you many save as docx,doc or rtf from the Word application.

If you want to save as docx without seeing PREVIEW
Code (fw): Select all Collapse
PRINT oPrn [PREVIEW] FILE "name.docx"
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 08:00 AM

Doing so, you get a Word document with images. Marco needs a Word document with text that can be selected.

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 08:09 AM
EMG,
that's right I need an editable document, Thank you to have specified the question.
Thinking that the program creates an Rtf in a easy way maybe it's simple also for us (for you :lol: )
Marco Boschi
info@marcoboschi.it
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 08:17 AM
Hello Marco,

This is how we do it:
https://forums.fivetechsupport.com/viewtopic.php?f=3&t=13495&p=69231&hilit=word+zip&sid=62c130be6eb450bc2a0aad7749c99f80#p69231

A DOCX file is essentially a ZIP file, and inside it, there's an XML file which is, in practice, a pure text file.

Best regards,
Otto


*************
But if you need a modern reporting tool, then you should use HTML. Everything else currently has no future.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 09:11 AM
Otto wrote:Hello Marco,

This is how we do it:
https://forums.fivetechsupport.com/viewtopic.php?f=3&t=13495&p=69231&hilit=word+zip&sid=62c130be6eb450bc2a0aad7749c99f80#p69231

A DOCX file is essentially a ZIP file, and inside it, there's an XML file which is, in practice, a pure text file.
The problem is not just to produce a docx file but to save a print preview as editable Word file.
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 09:17 AM

Hi Enrico,

Have you read the link? As far as I remember, I explained everything there. The XML file inside the DOCX is for that.

Best regards,

Otto

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 09:48 AM

And where do you get the XML file?

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 10:11 AM
DOCX-Format
The DOCX format is an XML-based file format for Word documents, used by Microsoft Word, especially since Word 2007. It replaces the older binary DOC format. DOCX files are actually ZIP archives containing multiple files and folders that collectively represent the entire document.

One key file within a DOCX archive is word/document.xml. This XML file contains the actual text of the document, along with information about its structure and formatting. The content of word/document.xml is written in a special markup language called WordprocessingML, designed for representing Word documents.

In word/document.xml, you will find:

Text Content: The actual text of the document, including paragraphs, headings, etc.

Formatting: Information about fonts, colors, alignment, paragraph formats, list formats, etc.

Structure: Tags defining the document's structure, such as section headings, footnotes, endnotes, margin notes, etc.

Elements like Tables and Images: References to other files in the DOCX archive that contain images, tables, and other non-text elements.

Special Tags: These are used to represent special features like tables of contents, hyperlinks, embedded objects, etc.

To view the contents of word/document.xml, you can open a DOCX file with an archiving program like WinRAR or 7-Zip, and then view the word/document.xml file with a text editor or an XML viewer. Knowledge of XML is helpful to understand the content and structure of this file.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 10:17 AM

Otto, you did not get the point.

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 10:28 AM

Enrico, Please describe again exactly what you want to do. I'm sure it can be solved.

Best regards,

Otto

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 10:34 AM

Ok. You have a normal FWH print preview. You can save the preview to Word but the result is not editable (it is a series of images). How to get an editable Word result instead?

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 10:48 AM

Otto,

what can I do with the xml inside the word file?

In Access (microsoft) when yo have a preview of a report you can export as rtf

it's very very beautiful

Marco Boschi
info@marcoboschi.it
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Convert a print to Rtf or doc
Posted: Thu Nov 30, 2023 10:54 AM

Enrico,
You need to create a WORD document in parallel. The question then is whether you should use WORD as a preview.

If you want to convert a FW report, you must build the WORD document in any case.

However, by manipulating the document.xml, you can use WORD as a report generator. You create your report in WORD and insert your own placeholders. We use [NAME] [etc] which is only necessary once when creating the template.

When you then run a report, you replace the placeholders with the values.

But I can only recommend switching to HTML right away.

Best regards,
Otto