支持`range.insertfile`

This commit is contained in:
csh 2024-01-22 14:24:02 +08:00
parent 1ac447c94e
commit 3ba20a7c5e
3 changed files with 11 additions and 1 deletions

Binary file not shown.

View File

@ -84,7 +84,7 @@ Begin
paragraph := Range.InsertNewParagraph(); paragraph := Range.InsertNewParagraph();
pic := docx_.AddPicture(picture, paragraph.Object()); pic := docx_.AddPicture(picture, paragraph.Object());
document_.Paragraphs.AddParagraph(paragraph.Index(), pic.Root()); document_.Paragraphs.AddParagraph(paragraph.Index(), pic.Root());
paragraph.Range.Clear(true); paragraph.Range.Delete();
self.SerializeInlineShapes(); self.SerializeInlineShapes();
run := pic.Root().FirstChildElement("w:r"); run := pic.Root().FirstChildElement("w:r");
trun := TOfficeObj("TRun"); trun := TOfficeObj("TRun");

View File

@ -785,3 +785,13 @@ Function TSDocxRange.ReadStart();
Begin Begin
return range_obj_.GetStart(); return range_obj_.GetStart();
End; End;
Function TSDocxRange.InsertFile(FileName, Range, ConfirmConversions, Link, Attachment);
Begin
alias := "";
paragraph := self.InsertNewParagraph();
docx_.InsertFile(alias, FileName, paragraph.Root());
paragraph.Range.Delete();
document_.Paragraphs.Init(docx_);
End;