TextCursor.getText().insertTextContent(TextCursor, Graphic, False)įound = ThisComponent.findNext( Found. Graphic.AnchorType = .TextContentAnchorType.AS_CHARACTER Graphic.GraphicURL = Bitmaps.getByName(gname) Graphic = Document.createInstance(".GraphicObject") TextCursor = Found.getText().createTextCursor() SearchDescriptor.SearchRegularExpression = Trueįound = Document.findFirst(SearchDescriptor) SearchDescriptor = Document.createSearchDescriptor() Sub ReplaceTextTagsWithImageīitmaps = Document.createInstance(".BitmapTable") from the regular expression to match multiple digits instead of multiple of anything. Instead, get the text object and cursor from Found.Īlso, remove. ![]() Headers, tables and so on have their own text object, so the text object of the main document will not work. I am not sure how to refer ranges in search and replace. This code works fine when Tag text is not in header/footer/table, however if i define tag in header/footer/table i get error ".RuntimeException:" at TextCursor.gotoRange(Found, False) To add page numbers to OpenOffice documents, you would usually add a header or footer to the document first and then select Insert > Fields > Page Number. ReplaceTextTagsWithImage(sFileToBeReplaced,sImageFile) Procedure TForm6.Button3Click(Sender: TObject) To insert a header, click Insert > Header > Default (or the page style, if not Default) as shown below. Txt.insertTextContent(TextCursor, Graphic, False) įound := Document.findNext(Found.getEnd, SearchDescriptor) įileParams := CreateProperty('Overwrite',True) ĭocument.storeAsURL(afileurl, FileParams) Can we insert header and footer in Open Office Writer. ServiceManager := CreateOleObject('') ĭesktop := ServiceManager.createInstance('.Desktop') įileParams := VarArra圜reate(, varVariant) įileParams := CreateProperty('Hidden',True) Result := ServiceManager.Bridge_GetStruct('.PropertyValue') The best way to insert a page number is to have the cursor where you want it and select the Insert tab, then Page Number -> Current Position -> Plain Number. Xinterface,xTextRange,curTextView : variant įunction CreateProperty(const AName: AnsiString const AValue: Variant): Variant ![]() ![]() How to insert image in OpenOffice Document using Delphi. I am using approach mentioned in my previous question. I have open office template documents where i need to search for tags like and replace it with a Image file reside in some folder at PC.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |