Hello,
Im new to progress and i have a question about merge a Word Template with an XLSX file.
I already have the folowing code but now I want to know how I can make for each record from the XLSX file a new Word document.
Also I want to know how I can save each Word document with a file name of a record that is stored in the XLSX file.
Do I need a Temp-Table for this?
Greatz Rick
Define Variable chWordApplication As Com-handle No-undo.
Define Variable chWordTemplate As Com-handle No-undo.
Define Variable chMerge As Com-handle No-undo.
Define Variable chNewDoc As Com-handle No-undo.
Create "Word.Application" chWordApplication.
chWordApplication:ScreenUpdating = True.
chWordApplication:visible = False.
chWordApplication:displayAlerts = False.
/* Opent de template */
chWordTemplate = chWordApplication:documents:Open("h:\code\bestanden\test.docx",,Yes,False).
chMerge = chWordTemplate:MailMerge.
/* Opent de data source */
chMerge:OpenDataSource("h:\code\bestanden\test.xlsx").
chMerge:SuppressBlankLines = False.
/* Runt het samenvoegen */
chMerge:Execute.
/* Maakt het nieuwe samengevoegde document */
chNewDoc = chWordApplication:ActiveDocument.
chNewDoc:fields:update.
chWordApplication:visible = True.
Release Object chWordTemplate.
Release Object chMerge.
Release Object chNewDoc.
Release Object chWordApplication.
Can you just chunk the resulting Word document to multiple files? I assume that the content of the document is a repeating letter just addressed to different receipient each page.
Every 2 pages Ill have to chunk the pages, but how can i do that?
How can I save each document with a file name from the XLSX?
I would assume that the letters are arranged in the same position in the Excel file.
Yes they are aranged in the same position of the excel file.
In the excel file are 7000 records.
After saving the letters I will add them to an application this section has been written.
It's been a while since I manipulated a Word document. You will need to select using the Range method and cut and paste it to a new Word Document.
If you're going to this level, you might wanna try using Microsoft.Office.Interop.Word and Microsoft.Office.Interop.Excel instead of COM automation.
Can i use that in openedge 10.2B ?
Can i use that in openedge 10.2B ?
Certainly. But officially you need to be on Service Pack 2.
http://blog.consultingwerk.de/consultingwerkblog/2010/09/progress-relaxes-usage-restrictions-of-gui-for-net-bridge-with-10-2b-service-pack/
im on SP2. I will search on google to find my solution or is here anyone with a solution?
Problem has been solved with a TempTable.
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/26/Word_5F00_TT.rar.zip:550:0]