OfficeAutomation: Added documentation

git-svn-id: svn://ultimatepp.org/upp/trunk@1246 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2009-05-29 21:27:36 +00:00
parent 39ed21b88e
commit 94110ddc46
6 changed files with 300 additions and 49 deletions

View file

@ -73,7 +73,7 @@ public:
OfficeDoc();
~OfficeDoc();
static bool IsAvailable(String program);
static bool IsAvailable(String type);
bool Init(String type);
@ -91,7 +91,7 @@ public:
bool Print();
bool SetSaved(bool);
bool SetSaved(bool saved);
bool SaveAs(String fileName, String type = "doc");
bool Quit();

View file

@ -11,9 +11,9 @@ esES("Error")
T_("OfficeAutomation internal error. Command \"%s\" not found for object or "
"problem when running it")
esES("Error interno en OfficeAutomation. Orden \"%s\" no encontrada para objeto o ")
"problema al ejecutarla")
esES("Error interno en OfficeAutomation. Orden \"%s\" no encontrada para objeto "
"o problema al ejecutarla")
T_("Ole error")
esES("Error en Ole")
@ -25,6 +25,3 @@ esES("Libro de Excel no abierto correctamente")
T_("Word document not loaded properly")
esES("Documento de Word no abierto correctamente")

View file

@ -1,17 +1,20 @@
description "Automation of Office suites OpenOffice and Microsoft\377";
uses
Core;
library(WIN32) Oleaut32;
file
OfficeAutomation.h,
OfficeAutomationBase.h,
OfficeAutomation.cpp,
src.tpp,
OfficeAutomation.t;
mainconfig
"" = "MT";
description "Automation of Office suites OpenOffice and Microsoft\377BI28,170,255";
noblitz;
uses
Core;
library(WIN32) Oleaut32;
file
OfficeAutomation.h,
OfficeAutomationBase.h,
OfficeAutomation.cpp,
srcdoc.tpp,
src.tpp,
OfficeAutomation.t;
mainconfig
"" = "MT";

View file

@ -0,0 +1,121 @@
topic "OfficeDoc class reference";
[ $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9; $$1,0#37138531426314131252341829483380:structitem]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
[H6;0 $$4,0#05600065144404261032431302351956:begin]
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:codeitem]
[{_}
[s1;:OfficeDoc`:`:class: [@(0.0.255)4 class][4 _][*4 OfficeDoc]&]
[s0;4 &]
[s0; [+92 OfficeDoc class serves to manage documents made with OpenOffice
Doc or Microsoft Office Word.]&]
[s0; [+92 The class methods are designed to be as simple as possible
and are exactly the same for both suites.]&]
[s0; [+92 OfficeDoc handles the suites through `"Ole Automation`" so
it requires either OpenOffice or Microsoft Office to be previosly
installed in the computer.]&]
[s0;2 &]
[ {{10000F(128)G(128)@1 [s0;%% [* Constructor detail]]}}&]
[s4; &]
[s5;:OfficeDoc`:`:OfficeDoc`(`): [* OfficeDoc]()&]
[s2;%% OfficeDoc constructor. It has no arguments as in function
Init() it is defined which Office suit is going to be used.&]
[s0;i448;a25;kKO9;:noref:@(0.0.255)2 &]
[ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&]
[s4; &]
[s5;:OfficeDoc`:`:`~OfficeDoc`(`): [@(0.0.255) `~][* OfficeDoc]()&]
[s2;%% OfficeDoc destructor. It closes document editor application.&]
[s3; &]
[s4;* &]
[s5;:OfficeDoc`:`:IsAvailable`(String`): [@(0.0.255) static] [@(0.0.255) bool]_[* IsAvailab
le]([_^String^ String]_[*@3 type])&]
[s2;%% It checks if office suit of name [%-*@3 type ]is available to
be init. &]
[s2;%% Valid values are `"Open`" and `"Microsoft`".&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:Init`(String`): [@(0.0.255) bool]_[* Init]([_^String^ String]_[*@3 type])&]
[s2;%% Initializes OfficeSheet to use [%-*@3 type].suite.&]
[s2;%% Valid values are `"Open`" and `"Microsoft`".&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:AddDoc`(bool`): [@(0.0.255) bool]_[* AddDoc]([@(0.0.255) bool]_[*@3 visible
])&]
[s2;%% Opens a new document. If [%-*@3 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.&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:OpenDoc`(String`,bool`): [@(0.0.255) bool]_[* OpenDoc]([_^String^ String]_
[*@3 fileName], [@(0.0.255) bool]_[*@3 visible])&]
[s2;%% Opens an existing document file whose name is [%-*@3 fileName.
]If [%-*@3 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.&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:SetFont`(String`,int`): [@(0.0.255) bool]_[* SetFont]([_^String^ String]_
[*@3 font], [@(0.0.255) int]_[*@3 size])&]
[s2;%% Sets the [%-*@3 font] type and [%-*@3 size ]in points. From now
all the text entered will use the font and size defined.&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:SetBold`(bool`): [@(0.0.255) bool]_[* SetBold]([@(0.0.255) bool]_[*@3 bold])
&]
[s2;%% Sets or unsets text [%-*@3 bold ]letters. From now all the text
entered will be bold or not depending on value [%-*@3 bold].&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:SetItalic`(bool`): [@(0.0.255) bool]_[* SetItalic]([@(0.0.255) bool]_[*@3 i
talic])&]
[s2;%% Sets or unsets text [%-*@3 italic].letters. From now all the
text entered will be italic or not depending on value [%-*@3 italic].&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:WriteText`(String`): [@(0.0.255) bool]_[* WriteText]([_^String^ String]_[*@3 v
alue])&]
[s2;%% Writes the text [%-*@3 value].&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:Select`(`): [@(0.0.255) bool]_[* Select]()&]
[s2;%% Selects all document.&]
[s3; &]
[s4; &]
[s5;:OfficeDoc`:`:Replace`(String`,String`): [@(0.0.255) bool]_[* Replace]([_^String^ Strin
g]_[*@3 search], [_^String^ String]_[*@3 replace])&]
[s2;%% Replaces value [%-*@3 search] with value [%-*@3 replace].in all
the document.&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:Print`(`): [@(0.0.255) bool]_[* Print]()&]
[s2;%% Prints the document.&]
[s3; &]
[s4; &]
[s5;:OfficeDoc`:`:SetSaved`(bool`): [@(0.0.255) bool]_[* SetSaved]([@(0.0.255) bool
][*@3 saved])&]
[s2;%% Sets or unsets the flag [%-*@3 saved], so that the application
did not ask for saving the document if the application receives
the Quit() order.&]
[s3; &]
[s4; &]
[s5;:OfficeDoc`:`:SaveAs`(String`,String`): [@(0.0.255) bool]_[* SaveAs]([_^String^ String]_
[*@3 fileName], [_^String^ String]_[*@3 type]_`=_`"doc`")&]
[s2;%% Saves the opened [%-*@3 fileName] with format [%-*@3 type]. &]
[s2;%% Formats admitted depend on the implementation but are basically:&]
[s2;%% -|`- OpenOffice: -|`"doc`", `"rtf`", `"psw`", `"html`", `"txt`",
`"pdf`" and `"odt`".&]
[s2;%% -|`- Microsoft: -|`"rtf`", `"html`", `"txt`", `"docx`" and `"doc`".&]
[s3;%% &]
[s4; &]
[s5;:OfficeDoc`:`:Quit`(`): [@(0.0.255) bool]_[* Quit]()&]
[s2;%% Closes the spreadsheet application.&]
[s2;%% -|It is also called by the class destructor&]
[s3; &]
[s4; &]
[s5;:OfficeDoc`:`:GetType`(`): [_^String^ String]_[* GetType]()&]
[s2;%% Returns the spreadsheet type.&]
[s2;%% Valid values are:&]
[s2;%% `- `"Open`"&]
[s2;%% `- `"Microsoft`"&]
[s0; ]

View file

@ -1,4 +1,4 @@
topic "class OfficeSheet";
topic "OfficeSheet class reference";
[ $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9; $$1,0#37138531426314131252341829483380:structitem]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
@ -6,15 +6,15 @@ topic "class OfficeSheet";
[H6;0 $$4,0#05600065144404261032431302351956:begin]
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:codeitem]
[{_}
[s1;:OfficeSheet`:`:class: [@(0.0.255) class]_[* OfficeSheet]&]
[s2;%% &]
[s0; OfficeSheet class serves to manage spreadsheets made with OpenOffice
or Microsoft Office.&]
[s0; The class methods are designed to be as simple as possible and
are exactly the same for using both suites.&]
[s0; OfficeSuite handles the suites through `"Ole Automation`" so
it requires either OpenOffice or Microsoft Office to be previosly
installed in the computer.&]
[s1;:OfficeSheet`:`:class: [@(0.0.255)4 class][4 _][*4 OfficeSheet]&]
[s2;*4 &]
[s0; [+92 OfficeSheet class serves to manage spreadsheets made with
OpenOffice Calc or Microsoft Office Excel.]&]
[s0; [+92 The class methods are designed to be as simple as possible
and are exactly the same for both suites.]&]
[s0; [+92 OfficeSheet handles the suites through `"Ole Automation`"
so it requires either OpenOffice or Microsoft Office to be previosly
installed in the computer.]&]
[s0;2 &]
[ {{10000F(128)G(128)@1 [s0;%% [* Constructor detail]]}}&]
[s4; &]
@ -24,10 +24,14 @@ Init() it is defined which Office suit is going to be used.&]
[s0;i448;a25;kKO9;:noref:@(0.0.255)2 &]
[ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&]
[s4; &]
[s5;:OfficeSheet`:`:`~OfficeSheet`(`): [@(0.0.255) `~][* OfficeSheet]()&]
[s2;%% OfficeSheet destructor. It closes spreadsheet application.&]
[s3; &]
[s4; &]
[s5;:OfficeSheet`:`:IsAvailable`(String`): [@(0.0.255) static] [@(0.0.255) bool]_[* IsAvail
able]([_^String^ String]_[*@3 type])&]
[s2;%% It checks if office suit of name [%-*@3 type].is availoable
to be init. &]
[s2;%% It checks if office suit of name [%-*@3 type].is available to
be init. &]
[s2;%% Valid values are `"Open`" and `"Microsoft`".&]
[s3;%% &]
[s4; &]
@ -40,16 +44,16 @@ to be init. &]
[s5;:OfficeSheet`:`:AddSheet`(bool`): [@(0.0.255) bool]_[* AddSheet]([@(0.0.255) bool]_[*@3 v
isible])&]
[s2;%% Opens a new spreadsheet. If [%-*@3 visible].is true the spreadsheet
will be visible. If not all the rest of operations made over
the spreadsheet will be hidden for the user.&]
application will be visible. If not all the rest of operations
made over the spreadsheet will be hidden for the user.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:OpenSheet`(String`,bool`): [@(0.0.255) bool]_[* OpenSheet]([_^String^ S
tring]_[*@3 fileName], [@(0.0.255) bool]_[*@3 visible])&]
[s2;%% Opens an existing spreadsheet file which name is [%-*@3 fileName.
]If [%-*@3 visible ]is true the spreadsheet will be visible. If
not all the rest of operations made over the spreadsheet will
be hidden for the user..&]
[s2;%% Opens an existing spreadsheet file whose name is [%-*@3 fileName.
]If [%-*@3 visible ]is true the spreadsheet application will be
visible. If not all the rest of operations made over the spreadsheet
will be hidden for the user.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:SetValue`(int`,int`,Value`): [@(0.0.255) bool]_[* SetValue]([@(0.0.255) i
@ -97,25 +101,133 @@ selected range by Select() or all the document.&]
[s4; &]
[s5;:OfficeSheet`:`:SetBold`(int`,int`,bool`): [@(0.0.255) bool]_[* SetBold]([@(0.0.255) in
t]_[*@3 col], [@(0.0.255) int]_[*@3 row], [@(0.0.255) bool]_[*@3 bold])&]
[s2;%% Set or unset cell bold letters in [%-*@3 col,] [%-*@3 row. col,]
[s2;%% Sets or unsets cell bold letters in [%-*@3 col,] [%-*@3 row. col,]
[%-*@3 row ]origin is (1, 1).&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:SetBold`(String`,bool`): [@(0.0.255) bool]_[* SetBold]([_^String^ Strin
g]_[*@3 cell], [@(0.0.255) bool]_[*@3 bold])&]
[s2;%% Set or unset cell bold letters in [%-*@3 cell. cell ]is a string
that indicates the cell location with letters to indicate the
column and a number to indicate the row as in `"B7`", following
[s2;%% Sets or unsets cell bold letters in [%-*@3 cell. cell ]is a
string that indicates the cell location with letters to indicate
the column and a number to indicate the row as in `"B7`", following
the format used in spreadsheets.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:SetBold`(bool`): [@(0.0.255) bool]_[* SetBold]([@(0.0.255) bool]_[*@3 bol
d])&]
[s2;%% Set or unset cell bold letters in the selected range by Select()
or all the document.&]
[s2;%% Sets or unsets cell bold letters in the selected range by
Select() or all the document.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:SetFont`(int`,int`,String`,int`): [@(0.0.255) bool]_[* SetFont]([@(0.0.255) i
nt]_[*@3 col], [@(0.0.255) int]_[*@3 row], [_^String^ String]_[*@3 name],
[@(0.0.255) int]_[*@3 size])&]
[s2;%% Sets in cell [%-*@3 col,] [%-*@3 row ]font [%-*@3 name ]with [%-*@3 size
]in points. [%-*@3 cell ]is a string that indicates the cell location
with letters to indicate the column and a number to indicate
the row as in `"B7`", following the format used in spreadsheets.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:SetFont`(String`,String`,int`): [@(0.0.255) bool]_[* SetFont]([_^String^ S
tring]_[*@3 cell], [_^String^ String]_[*@3 name], [@(0.0.255) int]_[*@3 size])&]
[s2;%% Sets in [%-*@3 cell ]font [%-*@3 name ]with [%-*@3 size ]in points.
[%-*@3 col,] [%-*@3 row ]origin is (1, 1).&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:SetFont`(String`,int`): [@(0.0.255) bool]_[* SetFont]([_^String^ String
]_[*@3 name], [@(0.0.255) int]_[*@3 size])&]
[s2;%% Sets the selected range by Select() or all the document with
font [%-*@3 name] with [%-*@3 size ]in points. &]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:Select`(String`): [@(0.0.255) bool]_[* Select]([_^String^ String]_[*@3 ra
nge])&]
[s2;%% Selects [%-*@3 range]. [%-*@3 range ]is a string that indicates
the range location with letters to indicate the column and a
number to indicate the row of the top left and bottom right vertex
as in `"B7:D9`", following the format used in spreadsheets.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:Select`(int`,int`,int`,int`): [@(0.0.255) bool]_[* Select]([@(0.0.255) i
nt]_[*@3 fromX], [@(0.0.255) int]_[*@3 fromY], [@(0.0.255) int]_[*@3 toX],
[@(0.0.255) int]_[*@3 toY])&]
[s2;%% Selects range from top left vertex [%-*@3 fromX,] [%-*@3 fromY
]to right bottom[%-*@3 toX,] [%-*@3 toY]. Origin is (1, 1).&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:Select`(`): [@(0.0.255) bool]_[* Select]()&]
[s2;%% Selects full sheet.&]
[s3; &]
[s4; &]
[s5;:OfficeSheet`:`:Print`(`): [@(0.0.255) bool]_[* Print]()&]
[s2;%% Prints the selected spreadsheet.&]
[s3; &]
[s4; &]
[s5;:OfficeSheet`:`:SaveAs`(String`,String`): [@(0.0.255) bool]_[* SaveAs]([_^String^ Strin
g]_[*@3 fileName], [_^String^ String]_[*@3 type]_`=_`"xls`")&]
[s2;%% Saves the opened [%-*@3 fileName] with format [%-*@3 type]. &]
[s2;%% Formats admitted depend on the implementation but are basically:&]
[s2;%% -|`- OpenOffice: -|`"xls`", `"pxl`", `"html`", `"txt`", `"pdf`"
and `"ods`".&]
[s2;%% -|`- Microsoft: -|`"csv`", `"html`", `"txt`", `"xlsx`" and `"xls`"&]
[s4; &]
[s5;:OfficeSheet`:`:Quit`(`): [@(0.0.255) bool]_[* Quit]()&]
[s2;%% Closes the spreadsheet application.&]
[s2;%% -|It is also called by the class destructor&]
[s3; &]
[s4; &]
[s5;:OfficeSheet`:`:InsertTab`(String`): [@(0.0.255) bool]_[* InsertTab]([_^String^ String]_
[*@3 name])&]
[s2;%% Inserts a new tab with [%-*@3 name].&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:ChooseTab`(String`): [@(0.0.255) bool]_[* ChooseTab]([_^String^ String]_
[*@3 name])&]
[s2;%% Makes active tab with [%-*@3 name].&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:ChooseTab`(int`): [@(0.0.255) bool]_[* ChooseTab]([@(0.0.255) int]_[*@3 i
ndex])&]
[s2;%% Makes active tab with [%-*@3 index], beginning from 1.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:RemoveTab`(String`): [@(0.0.255) bool]_[* RemoveTab]([_^String^ String]_
[*@3 name])&]
[s2;%% Remove tab with [%-*@3 name].&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:RemoveTab`(int`): [@(0.0.255) bool]_[* RemoveTab]([@(0.0.255) int]_[*@3 i
ndex])&]
[s2;%% Removes tab with [%-*@3 index], beginning from 1.&]
[s3;%% &]
[s4; &]
[s5;:OfficeSheet`:`:GetNumTabs`(`): [@(0.0.255) int]_[* GetNumTabs]()&]
[s2;%% Gets the number of tabs.&]
[s3; &]
[s4; &]
[s5;:OfficeSheet`:`:GetType`(`): [_^String^ String]_[* GetType]()&]
[s2;%% Returns the spreadsheet type.&]
[s2;%% Valid values are:&]
[s2;%% `- `"Open`"&]
[s2;%% `- `"Microsoft`"&]
[s3; &]
[s4; &]
[s5;:OfficeSheet`:`:CellToColRow`(const char`*`,int`&`,int`&`): [@(0.0.255) static]
[@(0.0.255) void]_[* CellToColRow]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 cell],
[@(0.0.255) int]_`&[*@3 col], [@(0.0.255) int]_`&[*@3 row])&]
[s2;%% Converts [%-*@3 cell] into [%-*@3 col] and [%-*@3 row]. [%-*@3 cell
]is a string that indicates the cell location with letters to
indicate the column and a number to indicate the row as in `"B7`",
following the format used in spreadsheets. [%-*@3 col,] [%-*@3 row
]origin is (1, 1)&]
[s4; &]
[s5;:OfficeSheet`:`:ColRowToCell`(const int`,const int`): [@(0.0.255) static]
[_^String^ String]_[* ColRowToCell]([@(0.0.255) const]_[@(0.0.255) int]_[*@3 col],
[@(0.0.255) const]_[@(0.0.255) int]_[*@3 row])&]
[s2;%% Returns the cell in text represented by [%-*@3 col], [%-*@3 row].
Cell returned is a string that indicates the cell location with
letters to indicate the column and a number to indicate the row
as in `"B7`", following the format used in spreadsheets. [%-*@3 col,]
[%-*@3 row ]origin is (1, 1)&]
[s3;%% &]
[s0; ]

View file

@ -0,0 +1,18 @@
topic "OfficeAutomation";
[ $$0,0#00000000000000000000000000000000:Default]
[a83;*R6 $$1,0#31310162474203024125188417583966:caption]
[{_}%EN-US
[s1; OfficeAutomation&]
[s0; [2 Includes classes to handle office programs like spreadsheets
and text editors:]&]
[s0;i150;O0; [^topic`:`/`/OfficeAutomation`/src`/OfficeDoc`$en`-us^2 OfficeDoc]&]
[s0;i150;O0; [^topic`:`/`/OfficeAutomation`/src`/OfficeSheet`$en`-us^2 OfficeSheet]&]
[s0;2 &]
[s0; [2 Supported office suites are OpenOffice and Microsoft Office.]&]
[s0;2 &]
[s0; [2 OfficeAutomation is implemented only in U`+`+ Windows version.]&]
[s0; &]
[s0; [/1 There have been efforts to implement the system on Posix systems.]&]
[s0; [/1 Support of any kind about OpenOffice UNO in order to implement
OfficeAutomation in Posix systems will be acknowledged.]&]
[s0; ]