CSV2XL Directives

Updated November 2019; see History

To assert greater control over details of the output file formatting, you may optionally insert //XL directives into the CSV file. These should be at the top, before any data lines, except in the case of the //XL,SetRow directive, which may be inserted anywhere above the affected row(s).

The syntax for the //XL directives is a bit tricky, and differs from normal A-Shell conventions. See Notes on Syntax.

//XL, SetDefaultFont {,fontname=<fontface>} {,fontsize=<pointsize>}

Establish the default font face and name to be used by the spreadsheet app.

Example:

//XL,SetDefaultFont,fontname=Courier New,fontsize=12

 

//XL, DefineFont, {fontid=}<fontid>, {name=<name>} {,size=<pointsize>} {,color=COLOR_xxx} {,Common //XL Parameters}

Define a font and give it an identifier which can then be used in a subsequent DefineFormat directive. This is only necessary when you want to use the same font in multiple formats, columns or rows. Otherwise, you can specify the font attributes directly when defining the format or setting the column or row attributes.

Examples:

//;Define bold green font, assign fontid “bold_green”

//XL,DefineFont,fontid=bold_green,bold,COLOR_GREEN

 

//;Define 14 Courier font, name it “courier14”

//XL,DefineFont,fontid=courier14,fontsize=14, fontname=Courier New

 

//XL, DefineFormat, {formatid=}<formatid> {,Common //XL Parameters}

Define a format and give it an identifier which can then be used in a subsequent SetCol and SetRow directives. This is only necessary when you want to use the same format in multiple columns or rows. Otherwise, you can specify the format attributes directly in the SetCol and/or SetRow directives.

Examples:

//;Define format named “fmtx” using bold_green font

//XL,DefineFormat,formatid=fmtx,fontid=bold_green,ALIGNH_CENTER

 

//;Define format named “fmtpink” with pink bg, bold violet text

//XL,DefineFont,formatid=fmtpink, FILLPATTERN_SOLID, patternfgc=COLOR_PINK, bold, fontcolor=COLOR_VIOLET

 

//XL, SetCol, {colfirst=}<##>, {,collast=<##>} {,width=##} {,total|nototal} {,Common //XL Parameters}

//XL, SetRow, {row = ##}, {height = ##} {,Common //XL Parameters}

Set attributes for a row. You may specify a row by number using the row=## parameter; the first row of the spreadsheet is considered row 1, whether it contains headings or data. It should be specified before the affected data rows. If the row parameter is omitted, the directive affects the next row to be output. Height is set in typographical points. The directive also supports setting attributes (such as colors) for the next row or a specified set of rows yet to be output.

//XL, SetINI, <inifile>

Establishes the INI file, overriding the one specified in the printer initialization file or subroutine. This directive can only appear once in a source file, and must appear at the top, before any data lines. This directive can only appear once in a CSV source file, and must appear before any data lines. Example:

//XL,SetINI,BAS:CUSXLS.INI

 

//XL, AddSheet {,srcbook=xxx.xls} {,dstbook=yyy.xls} {,sheetname=zzz}{,index=1} {,deletefirst}{,color=COLOR_xxx} {,protect} {,password=<password>}

//XL, SetPrint, attribute=value, attribute=value,...

//XL, AddComment, row=##, col=##, text=text {,width=pixels} {,height=pixels}

As of A-Shell 6.5.1668, this directive is ignored for XLSX format—i.e. is only supported for XLS format.

//XL, SetBanner, text=<banner text>

//XL, AddFootnote, {text=} text {,title=text}

//XL, SetGroup, rowfirst=##, rowlast=## {,collapsed} {,summary {=#}}

//XL,SetOutputFormat,<format>

This directive overrides the OutputFormat directive in the INI file. The two <format> options in either case are XLS and XLSX. As with the SetINI directive, it has to appear in the CSV source file prior to any lines that do not start with //XL.

//XL, SetRGBmode {,rgbmode=boolean}

History

2020 June, A-Shell 6.5.1682, CSV2XL.SBX edit 250:  SetOutputFormat directive added.

2019 December, A-Shell 6.5.1671, CSV2XL.SBX edit 243:  SetGroup directive added.

2019 November, A-Shell 6.5.1671, CSV2XL.SBX edit 241:  AddFootnote directive added.

2019 September, A-Shell 6.5.1668, CSV2XL.SBX edit 234:  SetBanner directive added.

2019 September, A-Shell 6.5.1668, CSV2XL.SBX edit 236:  In AddSheet, the extension may now be eliminated from the directive in order to allow the current output format to set the standard extension. Previously you had to specify either xls or xlsx which would then cause problems if the actual format didn't match.

2019 September, A-Shell 6.5.1668, CSV2XL.SBX edit 234:  Parameters total | nototal added to directive SetCol.

2019 September, A-Shell 6.5.1668, CSV2XL.SBX edit 233:  AddComment directive added.

2019 Feburary, CSV2XL.SBX edit 225, first included with A-Shell 6.5.1656:  SetINI directive implemented.