Page 2 of 2

Re: proprietary file format, why not and why....

Posted: Fri Nov 18, 2016 2:03 pm
by Zryip TheSlug
You might be interested by the XSLX Library I'm working on.

So far the Lib is capable to create, read or update native Excel xlsx files. Sheet creation, data export/import (values or formulas) and styles (font format, alignment, background, borders and number format) are supported.

Here is a code example for creating a new workbook file with some data and styles:

Code: Select all

on mouseUp
   local tArchivePath, tFirstLine, tFontStyleArray, tAlignmentStyleArray, tFillStyleArray, tBorderArray, tFormatArray

   put pathToFile("myworkbook.xlsx") into tArchivePath
   XLSX_Workbook_NewFile "myworkbook", "mac"
   put "value1,value2,10,20,30,other string,4,5,6,7,8,9,10,12/31/2016" into tFirstLine
   replace comma with tab in tFirstLine
   XLSX_Range_Values_Set "myworkbook", 1, "A1", tFirstLine, ""
   put "0.00" into tFormatArray["format string"]
   put "bold,italic" into tFontStyleArray["style"]
   put "green" into tFontStyleArray["color"]
   put "center" into tAlignmentStyleArray["HAlignment"]
   put "left,right,bottom,top" into tBorderArray["types list"]
   put "thin" into tBorderArray["line style"]
   put "blue" into tBorderArray["color"]
   put "red" into tFillStyleArray["interior color"]
   put "solid" into tFillStyleArray["type"]
   XLSX_Range_Styles_Set "myworkbook", 1, "C1:E1,M1", tFontStyleArray, tAlignmentStyleArray, tFillStyleArray, tBorderArray, tFormatArray
   XLSX_Sheet_New "myworkbook", "test2"
   XLSX_Range_Values_Set "myworkbook", 2, "A2", tFirstLine, ""
   put empty into tFontStyleArray
   put "double Accounting" into tFontStyleArray["underline"]
   XLSX_Range_Styles_Set "myworkbook", 2, "A2", tFontStyleArray, "", "", "", ""
   XLSX_Workbook_SaveFile "myworkbook", tArchivePath
   XLSX_Workbook_CloseFile "myworkbook"
end mouseUp
You can follow my work progress on my website:
http://www.aslugontheroad.com/in-progress


This will be a commercial product.

Re: proprietary file format, why not and why....

Posted: Fri Nov 18, 2016 11:08 pm
by sphere
Great work!
Love it.