OfficeDoc

 

class OfficeDoc : public DocPlugin, public StaticPlugin

 

OfficeDoc class serves to manage documents made with OpenOffice Doc or Microsoft Office Word.

The class methods are designed to be as simple as possible and are exactly the same for both suites.

OfficeDoc handles the suites through "Ole Automation" so it requires either OpenOffice or Microsoft Office to be previosly installed in the computer.

 

 

Constructor detail

 

OfficeDoc()

OfficeDoc constructor. It has no arguments as in function Init() it is defined which Office suite is going to be used.

 

 

Public Method List

 

~OfficeDoc()

OfficeDoc destructor. It closes document editor application.

 


 

bool IsAvailable(const char *type)

It checks if office suit of name type is available to be init.

Valid values are "Open" and "Microsoft".

 


 

bool Init(const char *type)

Initializes OfficeSheet to use type.suite.

Valid values are "Open" and "Microsoft".

 


 

bool AddDoc(bool visible)

Opens a new document. If visible.is true the document application will be visible. If not all the rest of operations made over the document will be hidden for the user.

 


 

bool OpenDoc(String fileName, bool visible)

Opens an existing document file whose name is fileName. If visible is true the document application will be visible. If not all the rest of operations made over the document will be hidden for the user.

 


 

bool SetFont(String font, int size)

Sets the font type and size in points. From now all the text entered will use the font and size defined.

 


 

bool SetBold(bool bold)

Sets or unsets text bold letters. From now all the text entered will be bold or not depending on value bold.

 


 

bool SetItalic(bool italic)

Sets or unsets text italic.letters. From now all the text entered will be italic or not depending on value italic.

 


 

bool WriteText(String value)

Writes the text value.

 


 

bool Select()

Selects all document.

 


 

bool Replace(String search, String replace)

Replaces value search with value replace.in all the document.

 


 

bool Print()

Prints the document.

 


 

bool SetSaved(bool saved)

Sets or unsets the flag saved, so that the application did not ask for saving the document if the application receives the Quit() order.

 


 

bool SaveAs(String fileName, String type = "doc")

Saves the opened fileName with format type.

Formats admitted depend on the implementation but are basically:

    OpenOffice:     "doc", "rtf", "psw", "html", "txt", "pdf" and "odt".

    Microsoft:     "rtf", "html", "txt", "docx" and "doc".

 


 

bool Quit()

Closes the spreadsheet application.

    It is also called by the class destructor

 


 

String GetType()

Returns the spreadsheet type.

Valid values are:

"Open"

"Microsoft"