LibOpenOffice allows applications to read/write all Apache OpenOffice file formats: *.odt, *.ods, *.odp and so on. Library can create new document on fly, extract any data from existing document or write data to existing document. It can be used by almost all programming languages developers for creating reports or other purposes.
LibOpenOffice has C/C++ headers, C# class for including in your project. Library requires OpenOffice installation on computer and works thought its components.
Our clients can use unlimited version of LibOpenOffice library in theirs commercial applications without any fees.
Apache OpenOffice software is also free unlike Microsoft Office.
Calc. Generate new spreadsheet example
Download result
#include "ooapi.h"
OOAPI3 *t = new OOAPI3();
if(t){
if(t->isInstall()){
if(t->connect2Calc("private:factory/scalc", false)){
t->setSheet(0);
t->setText(0,0,"Hello world!");
t->setVal(0,1, 500);
}
t->export2XLS("file:///D:/TEST.xls");
}
}
Calc. Create invoice example
Download result
OOAPI3 *t = new OOAPI3();
if(t){
if(t->isInstall()){
if(t->connect2Calc("private:factory/scalc", false)){
t->delSheetById(0);
t->delSheetById(0);
t->insertSheet("Invoice");
t->delSheetById(0);
t->setSheet(0);
t->setColWidth(0,3);
t->setFont4Col(1, "Calibri");
t->setFont4Col(2, "Calibri");
t->setFont4Col(3, "Calibri");
t->setFont4Col(4, "Calibri");
t->mergeRange("D2", "E2");
t->setFontSize(3,1,18);
t->setText(3,1,"Invoice #467");
t->setBgColor(3,1,253,251,214);
t->setBorders(3,1,1,1,1,1,255,255,255);
t->setFontSize(3,2,11);
t->setText(3,2,"Date: 25.06.2013");
t->setBorders(3,2,0,0,1,0,255,255,255);
t->setFontSize(3,3,11);
t->setText(3,3,"Customer ID: 38134");
t->setBorders(3,3,0,0,1,0,255,255,255);
t->setColWidth(1,69);
t->setFontSize(1,5,11);
t->setText(1,5,"Name: Jacob Smith");
t->setFontSize(1,6,11);
t->setText(1,6,"Adress: County Ave, Midland City, Alabama (AL), 36331");
t->setBorders(1,6,0,0,1,0,255,255,255);
t->setFontSize(1,7,11);
t->setText(1,7,"Phone: 334-123-4567");
t->setFontSize(1,8,11);
t->setText(1,8,"E-Mail: smith.jacob@gmail.com");
t->setFontSize(1,10,11);
t->setText(1,10,"Item, discription");
t->setBorders(1,10,1,1,1,1,0,0,0);
t->setBgColor(1,10,253,251,214);
t->setHoriz(1,10,2);
t->setFontSize(2,10,11);
t->setText(2,10,"QTY");
t->setBorders(2,10,1,1,1,1,0,0,0);
t->setBgColor(2,10,253,251,214);
t->setHoriz(2,10,2);
t->setFontSize(3,10,11);
t->setText(3,10,"Unit price");
t->setBorders(3,10,1,1,1,1,0,0,0);
t->setBgColor(3,10,253,251,214);
t->setHoriz(3,10,2);
t->setFontSize(4,10,11);
t->setText(4,10,"Line Price");
t->setBorders(4,10,1,1,1,1,0,0,0);
t->setBgColor(4,10,253,251,214);
t->setHoriz(4,10,2);
t->setFontSize(1,11,11);
t->setText(1,11,"Electric kettle");
t->setBorders(1,11,1,1,1,0,0,0,0);
t->setFontSize(1,12,11);
t->setText(1,12,"Plate");
t->setBorders(1,12,1,0,1,0,0,0,0);
t->setFontSize(1,13,11);
t->setText(1,13,"Coffee cup");
t->setBorders(1,13,1,0,1,1,0,0,0);
t->setFontSize(2,11,11);
t->setText(2,11,"1");
t->setBorders(2,11,1,1,1,0,0,0,0);
t->setFontSize(2,12,11);
t->setText(2,12,"4");
t->setBorders(2,12,1,0,1,0,0,0,0);
t->setFontSize(2,13,11);
t->setText(2,13,"6");
t->setBorders(2,13,1,0,1,1,0,0,0);
t->setFontSize(3,11,11);
t->setHoriz(3,11,3);
t->setText(3,11,"57.43");
t->setBorders(3,11,1,1,1,0,0,0,0);
t->setFontSize(3,12,11);
t->setHoriz(3,12,3);
t->setText(3,12,"12");
t->setBorders(3,12,1,0,1,0,0,0,0);
t->setFontSize(3,13,11);
t->setHoriz(3,13,3);
t->setText(3,13,"5.12");
t->setBorders(3,13,1,0,1,1,0,0,0);
t->setFontSize(4,11,11);
t->setHoriz(4,11,3);
t->setText(4,11,"=C12*D12");
t->setBorders(4,11,1,1,1,0,0,0,0);
t->setFontSize(4,12,11);
t->setHoriz(4,12,3);
t->setText(4,12,"=C13*D13");
t->setBorders(4,12,1,0,1,0,0,0,0);
t->setFontSize(4,13,11);
t->setHoriz(4,13,3);
t->setText(4,13,"=C14*D14");
t->setBorders(4,13,1,0,1,1,0,0,0);
t->setBgColor(3,15,253,251,214);
t->setFontSize(3,15,11);
t->setHoriz(3,15,3);
t->setText(3,15,"Sub total");
t->setBorders(3,15,1,1,1,1,0,0,0);
t->setBgColor(3,16,253,251,214);
t->setFontSize(3,16,11);
t->setHoriz(3,16,3);
t->setText(3,16,"Taxes");
t->setBorders(3,16,1,1,1,1,0,0,0);
t->setBgColor(3,17,253,251,214);
t->setFontSize(3,17,11);
t->setHoriz(3,17,3);
t->setText(3,17,"Total");
t->setBorders(3,17,1,1,1,1,0,0,0);
t->setFontSize(4,15,11);
t->setHoriz(4,15,3);
t->setText(4,15,"=SUM(E12:E14)");
t->setBorders(4,15,1,1,1,1,0,0,0);
t->setFontSize(4,16,11);
t->setHoriz(4,16,3);
t->setText(4,16,"=E16*0.2");
t->setBorders(4,16,1,1,1,1,0,0,0);
t->setFontSize(4,17,11);
t->setHoriz(4,17,3);
t->setText(4,17,"=SUM(E16:E17)");
t->setBorders(4,17,1,1,1,1,0,0,0);
t->setBold(4,17);
t->mergeRange("B21", "E21");
t->setHoriz(1,20,2);
t->setFontSize(1,20,11);
t->setText(1,20,"Thank you for your business!");
imgPosition iPos;
iPos.x = 500;
iPos.y = 500;
imgSize iSize;
iSize.h = 1520;
iSize.w = 5400;
t->insertImage(iPos,iSize,"file:///D:/4k-soft.png");
}
t->export2XLS("file:///C:/Invoice.xls");
}
}
Calc. Extract and edit data from existing spreedsheet example
Download result
OOAPI3 *t = new OOAPI3();
if(t){
if(t->isInstall()){
if(t->connect2Calc("file:///D:/TEST.xls", false)){
t->setSheet(0);
t->setColWidth(0, 50);
char * text = t->getText(0,0);
char * newtext = " LibOpenOffice!";
strcat(text, newtext);
t->setText(0,0, text);
delete text;
delete newtext;
/////////////////////////////FONTS
t->setText(0,3,"1.1223");
t->setFontSize(0,3,14);
t->setFont4Cell(0,3,"MS Comic Sans");
t->setCellStyle(0,3,S_PERCENT);
t->setStrikeout(0,3,true);
t->setText(0,5,"12:53");
t->setFontSize(0,5,18);
t->setFont4Cell(0,5,"Calibri");
t->setCellStyle(0,5,S_TIME_PA);
t->setBold(0,5);
t->setUnderline(0,5,true);
t->setText(0,7,"1234235.23");
t->setFontSize(0,7,8);
t->setFont4Cell(0,7,"Arial Black");
t->setCellStyle(0,7,S_SCTFC_F);
t->setItalic(0,7);
//////////////////////////////////FORMULA
t->setText(0,9,"=A4*0.02");
t->setText(0,11,"=SUM(A4;A8)");
t->setText(0,13,"=AVERAGE(A8;A4)");
//////////////////////////////////
t->mergeRange("A16","A18");
t->mergeRange("A20","A22");
t->mergeRange("A24","A26");
///////////////////////////////////MERGED
t->setText(0,15,"Merged range(A16:A18)");
t->setBorders(0,15,1,1,0,0,255,255,255);
t->setHoriz(0,15,1);
t->setVerticalAlignment(0,15,3);
t->setText(0,19,"Merged range(A20:A22)");
t->setBorders(0,19,0,0,1,1,255,255,255);
t->setHoriz(0,19,2);
t->setVerticalAlignment(0,19,2);
t->setText(0,23,"Merged range(A24:A26)");
t->setBorders(0,23,1,1,1,1,255,255,255);
t->setHoriz(0,23,3);
t->setVerticalAlignment(0,23,1);
/////////////////////////////////////SAVE TO DISK
t->export2XLS("file:///C:/styles_example.xls");
}
}
}