Hi friends,
once again I'm stuck with a simple (?) problem:
I am doing a lot of processing of Word files. Mostly simple stuff, macro programming, applying styles to certain sections, iterating over all files in folder/subfolders, etc.
One process however is quite... work-intensive and is being done on sometimes thousands of files.
Doing this with a Word macro is rather... inefficient...
It DOES work, but my Word is then blocked for half an hour or more.
This is why I'm trying to move this process entirely away from Word. The process involves three different types of files; two are text formats, one are rich text files.
I got a grip one the text files, and am now transforming them to XMLs which works quite nicely.
The rich text files however pose problems, as I need to apply MS Word formatting to these - but don't want that to be done in Word as it's too damn slow.
I am trying with a RichTextBox in VB6. Alas, it seems the RTFBox won't let me define my RTF header the way I like it. This is what I try ( i only removed a few formattings for readability's sake:
Now, this is my debug.Print of the TextRTF after this code has run:
As you can see, the RTFBox only took the first font of my definition (MS Sans Serif is the box's default).
The colortable, the stylesheet and the character style of my "Cuckoo!" are gone!
Why?
![[3eyes] [3eyes] [3eyes]](/data/assets/smilies/3eyes.gif)
Does any of you have an idea what I am doing wrong?
Or does a RichTextBox simply not ALLOW such RTF coding?
I haven't found anything satisfactory on Googling this issue.
Thanks!!
Makey
[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
once again I'm stuck with a simple (?) problem:
I am doing a lot of processing of Word files. Mostly simple stuff, macro programming, applying styles to certain sections, iterating over all files in folder/subfolders, etc.
One process however is quite... work-intensive and is being done on sometimes thousands of files.
Doing this with a Word macro is rather... inefficient...
It DOES work, but my Word is then blocked for half an hour or more.
This is why I'm trying to move this process entirely away from Word. The process involves three different types of files; two are text formats, one are rich text files.
I got a grip one the text files, and am now transforming them to XMLs which works quite nicely.
The rich text files however pose problems, as I need to apply MS Word formatting to these - but don't want that to be done in Word as it's too damn slow.
I am trying with a RichTextBox in VB6. Alas, it seems the RTFBox won't let me define my RTF header the way I like it. This is what I try ( i only removed a few formattings for readability's sake:
Code:
Dim rtf As String
rtf = "[maroon]{\rtf1\ansi\ansicpg1252\uc1\deff1 [/maroon][navy]{\fonttbl {\f1 \fmodern\fcharset0\fprq1 Courier New;}{\f2 \fswiss\fcharset0\fprq2 Arial;}{\f3 \froman\fcharset0\fprq2 Times New Roman;}}[/navy]" & _
[olive]{\colortbl \red0\green0\blue0; ... }[/olive]" & _
"[purple]{\stylesheet {\s0 \sb80\slmult1\widctlpar\fs20\f1 \snext0 Normal{\s0 \sb80\slmult1\widctlpar\fs20\f1\highlight7 \snext0 Normal;} ... }}[/purple][teal]\viewkind4\viewscale100\pard\plain[/teal]" & vbNewLine
outRTF.SelRTF = rtf & vbNewLine & "\cs5 [blue]Cuckoo![/blue]\par}}}"
Code:
{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}{\f1\fnil\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs24 Cuckoo!
\par \pard\f1\fs17
\par }
As you can see, the RTFBox only took the first font of my definition (MS Sans Serif is the box's default).
The colortable, the stylesheet and the character style of my "Cuckoo!" are gone!
Why?
![[3eyes] [3eyes] [3eyes]](/data/assets/smilies/3eyes.gif)
Does any of you have an idea what I am doing wrong?
Or does a RichTextBox simply not ALLOW such RTF coding?
I haven't found anything satisfactory on Googling this issue.
Thanks!!
Makey
[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell