Skip to main content
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
Is Excel not available?

------------------------------
Marcus Rhodes
marcus1@thinqware.com
------------------------------
Is Excel not available?

------------------------------
Marcus Rhodes
marcus1@thinqware.com
------------------------------
The users are expecting a Word document.

------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
The users are expecting a Word document.

------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
If it must be Word, something I've done in the past is create a .rtf document containing placeholders for the data.  Then just read the .rtf file, swap in the data, and write the results out to a network share.  If the columns/rows are not constant, then you have to get a bit craftier with your Pick code, to add those fields to the .rtf, but I'm pretty sure it can be done.

------------------------------
Marcus Rhodes
marcus1@thinqware.com
------------------------------
If it must be Word, something I've done in the past is create a .rtf document containing placeholders for the data.  Then just read the .rtf file, swap in the data, and write the results out to a network share.  If the columns/rows are not constant, then you have to get a bit craftier with your Pick code, to add those fields to the .rtf, but I'm pretty sure it can be done.

------------------------------
Marcus Rhodes
marcus1@thinqware.com
------------------------------
I have not tried this, but if it were doing it I would explore something similar to the RTF approach, but take a docx file that would act as the template, unzip it, grab the word/document.xml file, swap in your table, and zip it back up again.

------------------------------
Henry Unger
President
Hitech Systems Inc
Encino CA US
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
There is an open-source product from Eclipse called BIRT that can output print jobs from Universe/Unidata in DOCX format. If you look at the BIRT gallery you will find some pretty cool examples. BTW BIRT can output PDF, HTML, and XLXS as well.

Posted: 12-16-2022 16:20

------------------------------
Doug Averch
Owner
U2 Logic
------------------------------
I have not tried this, but if it were doing it I would explore something similar to the RTF approach, but take a docx file that would act as the template, unzip it, grab the word/document.xml file, swap in your table, and zip it back up again.

------------------------------
Henry Unger
President
Hitech Systems Inc
Encino CA US
------------------------------

Thank you @M Arcus1 and @Henry Unger !

I'll definitely explore the rtf suggestions.​​



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
We use AdvancedWare AWForms to do this kind of thing.  Very easy to use and very nice output.  We've changed all our outward facing forms to use AWForms, Invoices, Sales Orders, POs, RMAs, etc.

They use the same technology that others on the list have suggested by creating an RTF form and having placeholders like SO_NBR, SO_DATE etc.  Then in your program you assign these variables.

------------------------------
David Green
Computer Programmer
Rocket Forum Shared Account
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
Shawn,

Many moons ago, I had used this simple little trick to 'create' word documents:  
  • Create the document with HTML formatting, which I assume is how you are creating the tables. This should not require fully-formed HTML, you can  create the doc file with just the fragment needed for the table, like the <table...> ...  </table> content.
  • Save the file with a ".doc"  extension (not docx)
Word may ask the end user if they want to use word as their default HTML editor the first time they open the file  (answer: No, but it probably won't matter for end-users).  Obviously, a form creation tool would give you more options and functionality. This should work in a pinch, but test first to insure this will actually work for you!

------------------------------
Mark Sapp
Senior Software Developer
Rocket Internal - All Brands
------------------------------
Shawn,

Many moons ago, I had used this simple little trick to 'create' word documents:  
  • Create the document with HTML formatting, which I assume is how you are creating the tables. This should not require fully-formed HTML, you can  create the doc file with just the fragment needed for the table, like the <table...> ...  </table> content.
  • Save the file with a ".doc"  extension (not docx)
Word may ask the end user if they want to use word as their default HTML editor the first time they open the file  (answer: No, but it probably won't matter for end-users).  Obviously, a form creation tool would give you more options and functionality. This should work in a pinch, but test first to insure this will actually work for you!

------------------------------
Mark Sapp
Senior Software Developer
Rocket Internal - All Brands
------------------------------
Another good idea. Thank you.

Since I don't know what I'm looking at/for when reading in a binary file, finding the buckets to update in an html file might have a shallower learning curve, since it's a simple text file.

------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
Word can read Open Document Format files. They are well defined from either Open Office, Apache, or Libre Office.

------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------
I have not tried this, but if it were doing it I would explore something similar to the RTF approach, but take a docx file that would act as the template, unzip it, grab the word/document.xml file, swap in your table, and zip it back up again.

------------------------------
Henry Unger
President
Hitech Systems Inc
Encino CA US
------------------------------
I've done the RTF search and replace for document creation, but it does get very messy with tables that have a variable number of rows.  If you can fix the max number of rows ahead of time, that's the simplest approach.

Creating your own word .docx file is difficult, but not impossible.  I've spent a lot of time creating a subroutine that will take a query and create a .xlsx file - a real one, with formatting and formulas and everything.  You could do the same thing for word, if you grab a word document, rename to .zip, unzip it, you can view the xml contents.  To create a document from scratch you do the opposite and create a directory, jam in the appropriate xml files, zip it up and rename to .docx.  It's not trivial to do from pure basic - much easier on a windows machine with helper libraries from msft, but it's possible.

------------------------------
Ian McGowan
Principal Consultant
Rocket Forum Shared Account
------------------------------
I've done the RTF search and replace for document creation, but it does get very messy with tables that have a variable number of rows.  If you can fix the max number of rows ahead of time, that's the simplest approach.

Creating your own word .docx file is difficult, but not impossible.  I've spent a lot of time creating a subroutine that will take a query and create a .xlsx file - a real one, with formatting and formulas and everything.  You could do the same thing for word, if you grab a word document, rename to .zip, unzip it, you can view the xml contents.  To create a document from scratch you do the opposite and create a directory, jam in the appropriate xml files, zip it up and rename to .docx.  It's not trivial to do from pure basic - much easier on a windows machine with helper libraries from msft, but it's possible.

------------------------------
Ian McGowan
Principal Consultant
Rocket Forum Shared Account
------------------------------

Impressive. And thanks for making that code available!

Also, fortunately, the table sizes are fixed in this case.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
Word can read Open Document Format files. They are well defined from either Open Office, Apache, or Libre Office.

------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------
That's right.  I had forgotten about that.
Thank you!

------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------
Hi Shawn:

You could try creating an html document simple enough to do then send the output through a python routine that will convert an html to a true .doc document.

We have done that with Excel XML documents and converted them to true ".xlsx" Excel documents to avoid the extension mismatch error that Excel gives.

Do a convert HTML to Word in Python and you'll find quite a bit of info.

Regards, Sam

------------------------------
Samuel Powell
President/Developer
Advanced Transportation Systems Inc
Colorado Springs CO US
------------------------------
I'm in the very beginning stages of designing/developing a program that will create a file or files that can be opened/imported by Word to display multiple tables like these (screenshot from a word document):

I can handle part that has to calculate these details.

However, i'm not sure what my options are for generating a file that can be imported/read by Word.

It appears that Word can handle XML documents, so I'm wondering if that would be worth researching.

Our current process is very labor intensive and requires a lot of hands-on, so ideally, my program would generate the file(s), and Word could then open and display the info seen above with minimal manual massaging.

Any ideas would be appreciated.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------

It's been a while, but this project is finally complete and now in use.

I thought I should reach out with a 'heart-felt thank you' to everyone who offered suggestions. I needed help to get it off the ground and your feedback provided that.

I ended up going with the generation of the document.xml for a Word document since I was able to locate all  the positions where variables would be updated.

The old manual process required hours to complete and was error-prone. This new method requires less than a minute...a huge payoff for the users.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------