01-26-2017 05:31 AM
At SAS Community, there was solution for Combining RTF Documents into one document. http://www.lexjansen.com/pharmasug/2010/po/po05.pdf
I have used this Code, and successfully combine RTFs into a single file. However, now facing problem on creating TOC for SIngle file on which, all the Titles from RTFs' files will presented as TOCs.
Can anyone please help me?
01-26-2017 05:53 AM
Yes, I have looked at doing this some years back. It is really not simple and to my mind a bit of a waste of time. You would find it simpler to complile the RTF's in Word and use a bit of VBA scripting to create the TOC (if you really need to do it this way). We create combined PDF's of our output RTF files, and assign bookmakrs to each section - so no TOC. The reason being, as soon as your document is comibined with another then the TOC becomes more of an inconvienience.
There are plenty of VBA examples out there:
Etc. Then just save the file as RTF to get a final complete RTF with all the bits. Do note, you could also use this macro to load and combine all the RTF files in the first place.
01-26-2017 06:21 AM
01-26-2017 07:32 AM
Word decides TITLES based on the styles. Make sure the TITLE is set as Header 1 in Word and then it will be automatic.
Wothout knowing the rest of the process I'm not sure we can offer options on how to automate the process. If it's one for each file, maybe you can adapt a section of your code to track this and create a single page with the ToC that gets merged in separately.
01-26-2017 07:51 AM
Thanks for your suggestion. Using TOC in that case becoming manual and problem is i am not familiar with VBA code. Still looking any solution programmatically using SAS
If your could back up one step from RTF and use PROC DOCUMENT you can replay stored documents into a combined RTF and create a TOC, no WORD or VBA involved. My application which is similar to this is in PHARMA to produce BIMO listings that are bookmarked PDF.
You'll have to learn PROC DOCUMENT but that is easier than fiddling with raw RTF. Using PROC DOCUMENT keeps your application in SAS and you can use SAS to generate the PROC DOCUMENT statements (MAKE DIR SETLABEL LINK etc.) you will need to create the new combined document.
01-26-2017 07:58 AM