Einhugur OpenDocument Text Plugin for Xojo |

# EinhugurODT.Document Class

Class that represents odt Open Document Text document.
This class can Create, Read, Write and Edit OpenDocument Text documents (.odt files).

EinhugurODT.Container
Document

class EinhugurODT.Document

#### Constructors

Document (private) | Private constructor.

#### Properties

CreatedDate | Creation date of the document. (Meta data)
Creator | Creator of the document. (Meta data)
DefaultSection | Returns default section for the document. (Default page setup for the document)
Description | Document description. (Meta data)
ItemCount (Inherited) | Number of items in the container.
KeyWords | Keywords for the document. (Meta data)
LastModifiedBy | Name of person to last modify the document. (Meta data)
ModifiedDate | Last modification date of the document. (Meta data)
ParagraphCount (Inherited) | Returns number of paragraphs in the container.
Subject | Document subject. (Meta data)
TableCount (Inherited) | Returns number of tables in the container.
Title | Document title. (Meta data)

#### Methods

AppendParagraph (Inherited) | Appends paragraph without creating run.
AppendParagraph (Inherited) | Appends paragraph at back of the container, creating one run for the string passed in with this method.
AppendTable (Inherited) | Appends table to the back of the container.
ApplyFieldData | Applies filed data document wide. This covers paragraphs, tables, nested tables, nested paragraphs.
shared Create | Creates new document at given location.
Item (Inherited) | Returns item at given index. (Paragraphs or tables)
Items (Inherited) | Returns DocumentItemIterator for the items in the container. This property is for using with for each statements.
shared Open | Opens OpenDocument Text document.
Paragraph (Inherited) | Gets paragraph at given index.
Paragraphs (Inherited) | Returns ParagraphIterator for the paragraphs in the container. This property is for using with for each statements.
RemoveItem (Inherited) | Removes item from the container.
Save | Saves the document.
SaveAs | Saves the document with new name and or path.
Table (Inherited) | Gets table at given index.
Tables (Inherited) | Returns TableIterator for the tables in the container. This property is for using with for each statements.
UseUnitTestRandomCounter | This method is for internal unit testing of this plugin. You should not use this method in your projects.

#### Examples

This example creates a simple hello world Word document:
using EinhugurWord
var ft as FileType = new FileType
ft.Extensions = "docx"
ft.Name = "Word Document"
var f as FolderItem = FolderItem.ShowSaveFileDialog(ft, "New document.docx")
if f <> nil then
try
var doc as Document = Document.Create(f)
doc.Creator = "Einhugur test user"
doc.LastModifiedBy = "Einhugur test user"
doc.Subject = "My first"
// Empty document has one paragraph so we just populate the first one instead of adding
call doc.Paragraph(0).AppendRun("Hello world ! This is my first paragraph")
var p as Paragraph = doc.AppendParagraph("My second paragraph.")
p.Run(0).Bold = BooleanAttribute.YES
var r as Run = p.AppendRun(" And we can do styles.")
r.Italic = BooleanAttribute.YES
call doc.AppendParagraph("Check next page to see table we created")
// Lets add page break
doc.AppendPageBreak()
// And then finally paragraph with red text on the 2nd page
p = doc.AppendParagraph("Our paragraph on the 2nd page")
p.Run(0).TextColor = &c80 00 00
// Add some table
var t as Table = doc.AppendTable(3,2)
var row as TableRow = t.Row(0)
call row.Cell(0).Paragraph(0).AppendRun("Data in table cell")
call row.Cell(1).Paragraph(0).AppendRun("1")
call row.Cell(2).Paragraph(0).AppendRun("2 !")
doc.Save()
catch e as WordException
MessageBox e.Message
end try
end if

#### Supported Platforms:

- macOS Intel 64 bit
- macOS Apple Silicon
- Windows 32 bit
- Windows 64 bit
- Windows ARM 64 bit
- Linux 32 bit
- Linux 64 bit
- Linux ARM 32 bit
- Linux ARM 64 bit
- iOS