Skip to content

miyako/4d-plugin-xls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 

Repository files navigation

version platform license downloads

Note: for v17 and earlier, move manifest.json to Contents

4d-plugin-xls

4D plugin to write XLS documents using xlslib 2.5.0.

For reading cell values, you might want to consider this.

Build notes

suppress configure error "cannot run test program while cross compiling"

  • Library solution for Windows

https://github.com/miyako/msvc-xlslib

https://github.com/miyako/msvc-iconv

Note: XLSLIB has been modified to accept unicode path names on Windows.

Examples

  • Adding a SUM() function cell
$text:=Unicode_sample 

  //create a workbook
$book:=XLS WORKBOOK Create 

$sheetName:=$text
$sheet:=XLS WORKBOOK Create sheet ($book;$sheetName)

  //problem with Mac version of Excel 2010; OK on Windows
XLS WORKSHEET SET COL WIDTH ($sheet;0;20*256)

$row:=0  //zero-based
$col:=0  //zero-based
$format:=0  //NULL=default format (0x0F)
$cell:=XLS WORKSHEET Set cell text ($sheet;$row;$col;$format;$text)
XLS CELL RELEASE ($cell)  //we don't need this reference any more, so release it.

  //create a range reference node
$cell1:=XLS WORKSHEET Set cell real ($sheet;0;1;$format;1)
$cell2:=XLS WORKSHEET Set cell real ($sheet;1;1;$format;2)
$area:=XLS WORKBOOK Create area node ($book;$cell1;$cell2;XLS_CELL_ABSOLUTE_As1;XLS_CELLOP_AS_REFERENCE)
XLS CELL RELEASE ($cell1)
XLS CELL RELEASE ($cell2)

  //create a function node
$fn:=XLS WORKBOOK Create fn1 node ($book;XLS_FUNC_SUM;$area)
$cell:=XLS WORKSHEET Set cell fn ($sheet;2;1;$format;$fn)
XLS NODE RELEASE ($fn)
XLS NODE RELEASE ($area)
XLS CELL RELEASE ($cell)

XLS WORKSHEET RELEASE ($sheet)

$success:=XLS WORKBOOK Save document ($book;System folder(Desktop)+$text+".xls")

XLS WORKBOOK CLEAR ($book)

Discussions

https://forums.4d.com/Post//28120080/1/

日本語特有の制限

日本語のフォント名は指定できないようです。たとえばMS PゴシックMS PGothicと指定しなければなりません。

その他

フォントサイズはTWIP(ポイントの20分の1)単位で指定します。