Export To Word

Export To Word

Postby TimStone » Fri Jan 31, 2020 1:28 am

I hadn't looked at this previously but a client brought it to me today.

I create reports that are all text. They display fine in View mode, and the print without a problem.

When I save them to a file ( .doc ) or export using the Word icon in Preview, Word sees each page as a picture. As a result, it is impossible to edit the text in Word.

Surely I am doing something wrong here. What is it ? I'm using the latest FWH libraries and the latest Word included in Office 365.

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Export To Word

Postby Massimo Linossi » Fri Jan 31, 2020 7:56 am

The function exports the EMF image file to Word.
You can never edit the text.
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Export To Word

Postby TimStone » Fri Jan 31, 2020 5:26 pm

That seems of no value to me. Thus the data is not useable.

Is there a way to export that report to Word so it can be edited ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Export To Word

Postby MOISES » Fri Jan 31, 2020 6:29 pm

No, it's not possible in the current state.

You would either have to create a module to generate a Word file the way it is exported to Excel, or export it to plain text.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: Export To Word

Postby TimStone » Fri Jan 31, 2020 8:55 pm

I found a workaround. You can export it to a PDF, and then open that in Word which will convert it to editable text in the correct format.

We really shouldn't claim to have an export to word that just sends pictures which cannot be edited. That is not a functional export.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Export To Word

Postby Otto » Sat Feb 01, 2020 12:34 am

Hello Tim,
Thank you. You have found a great solution.
It should be easy to open word and then save it as docx. I made a short test.

Best regards
Otto

Code: Select all  Expand view

#Include "FiveWin.ch"

//--------------------------//

function Main()

   local oWord
   local oDoc
   local cDocument := "c:\_mist\umsatz.pdf"
   local cSaveAsFile := ""c:\_mist\umsatz.DOCX""

   oWord := CREATEOBJECT( "Word.Application" )
   oDoc := oWord:Documents:Open( cDocument )

   oWord:Visible := .t.

   cSaveAsFile := "c:\_mist\umsatz.DOCX"
   #define wdFormatXMLDocument 12
   oWord:ActiveDocument:SaveAs2( cSaveAsFile, wdFormatXMLDocument  )


   oDoc:Close( 0 )


   ? "ENDE"
Return nil

//----------------------------------------------------------------------------//

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: Export To Word

Postby Massimo Linossi » Sat Feb 01, 2020 9:53 am

Otto,
the FWH preview works with EMF files, that are images. If you export them in PDF
the resulting file is not editable. What you are doing is with PDF files that you can edit
and for this reason Word can make the same. If you want to have a DOC or PDF file
that you can modify you must make this not in the preview function but before.
So you must change the report or print function.
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Export To Word

Postby Otto » Sat Feb 01, 2020 10:15 am

Hello Massimo,
Thank you.
For me, with the code, I posted it is working fine.
I changed

function ConvertToWordDoc( oPreview ).

First, I create in silent a PDF, and then I open and save it with WORD to Docx.

Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: Export To Word

Postby TimStone » Sat Feb 01, 2020 8:25 pm

Massimo,

Using the latest version of FWH, I exported to a PDF. Of course it was saved. I did this from PREVIEW using the File Save option. Then I used Word to open the PDF. It is fully editable in Word. I made changes and saved it.

Perhaps something changed, but it is working this way. Once I reported it, from MY testing, Otto made his routine.

I will explore building in his option as an alternative to the Word Export button so we have a TRUE Word document. What we have now is of no value since Word can't do anything with it that a normal printer couldn't do directly.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Export To Word

Postby MOISES » Sun Feb 02, 2020 11:33 am

I totally agree, we need a native Word export option. However, the proposed fix by Otto does not work with Office versions prior to 2007, and I do not know if it will work well with Office 365 and the reduced versions of Word that come by default on some computers.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: Export To Word

Postby James Bott » Thu Feb 06, 2020 8:53 pm

We really shouldn't claim to have an export to word that just sends pictures which cannot be edited. That is not a functional export.


There are times when you don't want users to edit a report. Actually, I would say most times.

If you allow users to edit reports, they can make them inaccurate. This is normally one of the reasons for using software--to prevent inaccuracies in manually created data and/or reports.

If the software generated reports are wrong and the users are fixing them, then the software generated reports should be fixed in the software instead.

If there are times when perhaps something like titles need to be changed for a special report, then I would suggest providing a drop-down list instead, or just a separate report.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Export To Word

Postby TimStone » Thu Feb 06, 2020 11:15 pm

James,

In today's software market place, people like to do "mark ups" and notes on reports. We are not "editing" anything within the software. Instead, they are taking output and adding to it in individual situations.

In the case of one client, our system has many pages of "glossaries" or text templates. My client doesn't want to sit late at night in a cold and dark shop making changes. He wants to save that document, take it home, and make his modifications at his home computer. He reworks descriptions until he's happy with the result. THEN he takes the final printout of his work into the shop and makes the changes to these records within the software itself.

Fortunately, saving it as a PDF and then importing it into Word does work, and allows him to handle his specific needs.

Ti,
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 45 guests