Trying delete first page from a DOCX
Posted: Thu Sep 26, 2019 10:18 am
I'm trying delete first page of a document with this code:
When ShowMessage is executed, the page count showed is ok... The Editor.Pages.Delete(0) worked ok however when the document is saved the first page isn't delete.
What's the problem? Thanks
Code: Select all
var
i:Integer;
Temp:String;
begin
F:TForm;
with TDOCXReadWrite.Create(nil) do
try
LoadFromFile(Path);
F:=TForm.Create(nil);
try
with TAXWPreviewVcl.Create(nil) do
try
Parent:=F;
Document:=Editor;
Paint;
Editor.Pages.Delete(0);
ShowMessage(IntToStr(Editor.Pages.Count));
SaveToFile(Path);
finally
Free;
end;
finally
FreeANdNil(F);
end;
finally
Free;
end;
end;
What's the problem? Thanks