The SAS Output Delivery System and reporting techniques

How to have several RTF documents been packed into one document

Reply
Occasional Contributor
Posts: 17

How to have several RTF documents been packed into one document

HI,

 

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?

Sami

Super User
Super User
Posts: 7,984

Re: How to have several RTF documents been packed into one document

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:

https://msdn.microsoft.com/en-us/library/office/ff835785.aspx

https://social.msdn.microsoft.com/Forums/en-US/dbfaabd4-1f4c-4281-a3ca-b0ead28ef92d/how-to-insert-a-...

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.

Occasional Contributor
Posts: 17

Re: How to have several RTF documents been packed into one document

Hi,

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
Super User
Posts: 19,855

Re: How to have several RTF documents been packed into one document

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. 

Respected Advisor
Posts: 3,799

Re: How to have several RTF documents been packed into one document


Sami wrote:
Hi,

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. 

Occasional Contributor
Posts: 17

Re: How to have several RTF documents been packed into one document

Posted in reply to data_null__
Hi,

Many thanks. I am starting to look on PROC Document procedures. Is there any concise coding available already, you can suggest or i would start from SAS Help for
PROC Document?
Respected Advisor
Posts: 3,799

Re: How to have several RTF documents been packed into one document

There is a book about proc document and you can search at lexjansen.com

SAS Super FREQ
Posts: 8,868

Re: How to have several RTF documents been packed into one document

Posted in reply to data_null__
Here's a basic paper to get you started:
https://support.sas.com/resources/papers/sgf09/318-2009.pdf
cynthia
Ask a Question
Discussion stats
  • 7 replies
  • 218 views
  • 5 likes
  • 5 in conversation