I wonder how can I convert loaded DOCX document to RTF.
and also to convert loaded RTF to DOCX
I wonder how can I convert loaded DOCX document to RTF.
and also to convert loaded RTF to DOCX
Thanks , it works :)
I have another question related to performance of appending.
I've done the following test:
1. Load doc2 from file
2. Append 100 times to doc1 (which is empty)
The code is in my fist post. I've tried also with LoadFromStream() at cursor position.
I noticed that:
- If I load the content from .rtf-file the time is about 6 minutes (on my computer)
- If I load the content from .docx-file the time is about 1 second (on my computer)
Is it possible the reason to be only the format differences ?
Maybe I am missing some specific setting that affects the performance.
Regards
Hello,
For test purposes I use the following simple code to append one document to another several times:
for var i: System.Integer := 1 to Count do
begin
doc1.CPPosition := $FFFFFFF;
doc1.AppendAsSection(doc2);
doc1.ReformatAll;
end;
The result document looks as expected - all content is appended as sections.
But I wonder is there another way to append - not as sections?
Because currently if I want to change (for example) orientation of the result document in MS Word I have to Select All first and then change the orientation. Otherwise the orientation is changed only for a section.
Regards
Hi,
Thank you for the guidance :)
We made some experiments with size of table, columns and cells and we've managed to get what we need with .rtf-template :)
Do you have any idea about the other problem I described - with .docx-template:
Some inner borders of the table which are set to be invisible in the template and after wptools processing the are visible.
I've tried to hide/show all borders together, one-by-one etc. - but unfortunately no effect.
It would be great if you could give some advice.
Best Regards
Thanks for the reply.
1. About the table - You mean this property should be set during creating of the .rtf-document in MSWord, right ?
this is about the "shrink-ed" columns/cells ?
2. And what about the docx-document problem - the inner borders are hidden in the original document but visible in the document saved by WPTools?
Best Regards
Hi,
The problem is with WPTools 7.
Here in the sample I copy the the file just for test - to see if the same effect will appear:
"test1.docx" - without copy
"test2.docx" - with copy
But in my main application I need to keep original WPRichText unchanged as a "template" and have copies of it which I will modify with some dynamic data.
FYI:
I had a source.rft file and saved it as source.docx using MSWord (no changes - just SaveAs...) because I need to work with .docx from now on in my application.
So I use this source.docx
I don't have this problem with source.rtf file - table is fine there.
Best Regards
Hello :)
I'm trying the do the following using TWPRichText:
1. Load doc1 from file:
var
doc1, doc2: TWPRichText;
............
doc1.LoadFromFile('souce.docx');
doc1.Header.PageSize := wp_DinA4;
doc1.ReformatAll();
2. Save doc1 to file:
3. Copy doc1 to doc2 using the following code:
procedure TForm1.CopyDoc(source, dest: TWpRichText);
begin
with dest do
begin
Assign( source );
FastCopyProperties( source );
Align := source.Align;
ViewOptions := source.ViewOptions;
InsertPointAttr.Assign( source.InsertPointAttr );
AutomaticTextAttr.Assign( source.AutomaticTextAttr );see the attached
InsertPointAttr.Assign ( source.InsertPointAttr );
ProtectedTextAttr.Assign( source.ProtectedTextAttr );
ProtectedProp := source.ProtectedProp;
PrintParameter := source.PrintParameter;
end;
end;
Alles anzeigen
4. Save doc2 to file:
I open the three files (source.docx, test1,docx, test2.docx) in MSWord.
Please follow the link to see the screenshots of the files open in MSWord:
<edit: sorry we do not allow links for security reasons>
The saved files (test1.docx and test2.docx) the internal borders of the main table are visible.
They are not visible in the original file (source.docx)