DOC or RTF files concatenate

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)
Post Reply
Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

DOC or RTF files concatenate

Post by Jean-Marie Schwartz » 07 Dec 2012, 05:54

Hi! I'd like to concatenate files in DOC or RTF format but with retaining style sheets. I use shell script textutil convert from docx to doc, then cat all doc files. The concatenate file I get as a result seems to have lost all style sheets (though the formatting is retained, just the style sheets are not there any more). So is there a way to convert, cconcatenate doc files and retain style sheets?

Emma
Posts: 657
Joined: 07 Jul 2004, 08:43

DOC or RTF files concatenate

Post by Emma » 07 Dec 2012, 06:06

It's been a while.... I think I opened the concatenated file in Tex-Edit Plus and then put XPress Tags around the bold, italic etc bits. If you're not taking it into Quark, I suppose there are Word tags you could do the same?
Here are some lines from my script
replace looking for "^*" looking for styles {style:{bold, italic}, off styles:{underline}} replacing with "^*"
replace looking for "^*" looking for styles {style:{bold, italic, underline}} replacing with "^*"
replace looking for "^*" looking for styles {style:{italic, underline}, off styles:{bold}} replacing with "^*"
replace looking for "^*" looking for styles {style:{bold}, off styles:{italic, underline}} replacing with "^*"
replace looking for "^*" looking for styles {style:{underline}, off styles:{bold, italic}} replacing with "^*"
replace looking for "^*" looking for styles {style:{bold, underline}, off styles:{italic}} replacing with "^*"

Does that make any sense? Basically I used the fact that the styling was preserved to insert tags. It worked well!

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

DOC or RTF files concatenate

Post by Jean-Marie Schwartz » 07 Dec 2012, 08:21

Hi Emma! Thanks for your quick response.
Yes, it does make sense. I remember some posts a long time ago and on my side I had no real use of Word style sheets so I was happy with simple cat command. But I now need those style sheets for a new revue. I wasnt aware of the lost of style sheets.
So yes Ill probably go the Tex-Edit route. I know Michel posted a lot of interesting stuff here and there. Along with your saying and lines Ill try to get a script working fine.
Thanks again for your input.

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

DOC or RTF files concatenate

Post by Jean-Marie Schwartz » 18 Dec 2012, 22:38

Well it's not that easy. The Word files I get are supposed to have proper style sheets applied to the paragraphs. So what I'd like to perform is to get para styles from the Word files, convert the DOC files to RTF for retaining local formatting, open the RTF files in TE+ and process the replacings as kindly shown above. To that point, evrything's OK. My trouble is when the RTF file is imported in Quark, it comes up with squares in place of so called special characters. I can't seem to find a way of saving the text file (RTF) in some working format that would be XTG or TXT with UTF-8 or UTF-16 encoding. So what's the magic formula for saving my files from TE+ so that they import flawlessly in Quark? Do you happen to know?

Post Reply

Return to “QuarkXPress 8, 9 & 10: AppleScript”