Hi,
When I run the example that comes with TDOCXReadWriteVCL, I want to insert a formatted string into the doc document, but it fails. The code is as follows:
procedure TfrmMain.Button7Click(Sender: TObject);
var
Para: TAXWLogPara;
CHPX: TAXWCHPX;
begin
// MasterCHP contains the default characher properies.
// The CHPX is a list of exeptions of the CHP.
CHPX := TAXWCHPX.Create(DOCX.Editor.MasterCHP);
try
Para := DOCX.Editor.Paras.AppendPara;
CHPX.Size := 24;
CHPX.Bold := True;
CHPX.TColor := clRed;
CHPX.FillTColor := clBlack;
CHPX.FontName := 'Times New Roman';
Para.AppendPlainText(CHPX,'Lorem ipsum dolor sit amet.');
finally
CHPX.Free;
end;
end;
However,The string ‘Lorem ipsum dolor sit amet.’ is not formatted. Maybe I'm doing something wrong or else it would realy be great if this can be fixed soon.
Thanks for your help.
Unsuccessful use of CHPX Property!
Re: Unsuccessful use of CHPX Property!
Hello
The doc i formatted correct when I test the code.
How do you see that the doc is not formatted? Do you save it to a file?
The doc i formatted correct when I test the code.
How do you see that the doc is not formatted? Do you save it to a file?
Lars Arvidsson, Axolot Data
Re: Unsuccessful use of CHPX Property!
hello.
thank you for answer.I save str to abc.docs. my using office version is 2016. Maybe it has something to do with this?
thank you for answer.I save str to abc.docs. my using office version is 2016. Maybe it has something to do with this?
Re: Unsuccessful use of CHPX Property!
Hello
Please try this code:
Please try this code:
Code: Select all
var
DOCX: TDOCXReadWrite;
Para: TAXWLogPara;
CHPX: TAXWCHPX;
begin
DOCX := TDOCXReadWrite.Create(Nil);
try
Para := DOCX.Editor.Paras.AppendPara;
Para.AppendPlainText(DOCX.ComponentVersion);
CHPX := TAXWCHPX.Create(DOCX.Editor.MasterCHP);
try
Para := DOCX.Editor.Paras.AppendPara;
CHPX.Size := 24;
CHPX.Bold := True;
CHPX.TColor := clRed;
CHPX.FillTColor := clBlack;
CHPX.FontName := 'Times New Roman';
Para.AppendPlainText(CHPX,'Lorem ipsum dolor sit amet.');
finally
CHPX.Free;
end;
DOCX.SaveToFile('Test.docx');
finally
DOCX.Free;
end;
Lars Arvidsson, Axolot Data
Re: Unsuccessful use of CHPX Property!
Hello
Thank you very much
I tried this code, but still no success.But this code inspired me, so I browsed the “axolot.com”, in the "Version history" TOPIC, I saw this message:
---------------
2.00.01
! Wrong character properties when inserting text.
---------------
After running this code, I got the version of the component I used:
---------------
1.01.36
Lorem ipsum dolor sit amet.
---------------
I am guessing whether my component version is too low, causing this problem.
Thank you very much
I tried this code, but still no success.But this code inspired me, so I browsed the “axolot.com”, in the "Version history" TOPIC, I saw this message:
---------------
2.00.01
! Wrong character properties when inserting text.
---------------
After running this code, I got the version of the component I used:
---------------
1.01.36
Lorem ipsum dolor sit amet.
---------------
I am guessing whether my component version is too low, causing this problem.
Re: Unsuccessful use of CHPX Property!
Hello
Where did you download the component?
Where did you download the component?
Lars Arvidsson, Axolot Data
Re: Unsuccessful use of CHPX Property!
Hello
I got it in a group related to Delphi, but it is an unregistered version, I just tried it.I downloaded the latest trial version from axolot.com. and now, this problem has been solved. It seems that this is indeed caused by the lower version.
I got it in a group related to Delphi, but it is an unregistered version, I just tried it.I downloaded the latest trial version from axolot.com. and now, this problem has been solved. It seems that this is indeed caused by the lower version.