ooxml

Artifact [7ef9565bb6]
Login

Artifact 7ef9565bb6f76373a956b356ae495bc3527116132bbbdb065578549e27bafcac:

Wiki page [man-page] by alex 2019-11-22 13:35:29.
D 2019-11-22T13:35:29.820
L man-page
P 36d9e45837d93e1b1f0898dfa4c1645555d7d76b529c6f84ea0562d4dc92bf12
U alex
W 13048
<h2>
	Man-Page 
</h2>
<pre>
   ::ooxml::Default name value
   ::ooxml::RowColumnToString rowcol
   ::ooxml::StringToRowColumn name
   ::ooxml::CalcColumnWidth numberOfCharacters ?maximumDigitWidth? ?pixelPadding?
   ::ooxml::xl_sheets file
   ::ooxml::xl_read file args
   ::ooxml::xl_write args
                     method numberformat args
                     method defaultdatestyle STYLEID
                     method font args
                     method fill args
                     method border args
                     method style args
                     method worksheet name
                     method column sheet args
                     method row sheet args
                     method cell sheet {data {}} args
                     method autofilter sheet indexFrom indexTo
                     method freeze sheet index
                     method presetstyles
                     method presetsheets
                     method write filename
   ::ooxml::tablelist_to_xl lb args
</pre>
<hr>
<p>
	<b><a id="BORDERLINESTYLE"> BORDERLINESTYLE </a></b> 
</p>
<p>
	dashDot | dashDotDot | dashed | dotted | double | hair | medium | mediumDashDot | mediumDashDotDot | mediumDashDotDot | none | slantDashDot | thick | thin 
</p>
<p>
	<b><a id="COLOR"> COLOR </a></b> 
</p>
<p>
	0-65<br>
	Aqua | Black | Blue | BlueRomance | Canary | CarnationPink | Citrus | Cream | DarkSlateBlue | DeepSkyBlue | Eucalyptus | Fuchsia | Gray | Green | Karaka | LavenderBlue | LightCoral | LightCyan | LightSkyBlue | Lime | Lipstick | Maroon | Mauve | MediumTurquoise | Myrtle | Navy | NavyBlue | NightRider | Nobel | Olive | OrangePeel | PeachOrange | Portage | PrussianBlue | Purple | Red | RoyalBlue | SaddleBrown | SafetyOrange | Scampi | Silver | TangerineYellow | Teal | White | Yellow | SystemBackground | SystemForeground<br>
	RGB<br>
	aRGB 
</p>
<p>
	<b><a id="DEGREE"> DEGREE </a></b> 
</p>
<p>
	0-360 
</p>
<p>
	<b><a id="DIAGONALDIRECTION"> DIAGONALDIRECTION </a></b> 
</p>
<p>
	up | down 
</p>
<p>
	<b><a id="HORIZONTAL"> HORIZONTAL </a></b> 
</p>
<p>
	left | center | right 
</p>
<p>
	<b><a id="PATTERNTYPE"> PATTERNTYPE </a></b> 
</p>
<p>
	darkDown | darkGray | darkGrid | darkHorizontal | darkTrellis | darkUp | darkVertical | gray0625 | gray125 | lightDown | lightGray | lightGrid | lightHorizontal | lightTrellis | lightUp | lightVertical | mediumGray | none | solid 
</p>
<p>
	<b><a id="VERTICAL"> VERTICAL </a></b> 
</p>
<p>
	top | center | bottom 
</p>
<hr>
<p>
	<b>::ooxml::Default</b> name value 
</p>
<p>
	Overwrites default values 
</p>
<ul>
	<dl> 
		<dt> name = path</dt>
		<dd> (default = ".") </dd>
	</dl>
</ul>
<hr>
<p>
	<b>::ooxml::RowColumnToString</b> rowcol 
</p>
<p>
	Converts coordinates from numeric row,column (0,0) to Excel style alphanumeric (A1) etc. 
</p>
<ul>
	<p>
		return name 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::StringToRowColumn</b> name 
</p>
<p>
	Converts coordinates from Excel style alphanumeric (A1) to numeric row,column (0,0) etc. 
</p>
<ul>
	<p>
		return rowcol 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::CalcColumnWidth</b> numberOfCharacters {maximumDigitWidth 7} {pixelPadding 5} 
</p>
<p>
	Calculates the column width based on the number of characters 
</p>
<ul>
	<p>
		return width 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_sheets</b> file 
</p>
<ul>
	<p>
		return sheetInformation 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_read</b> file args 
</p>
<p>
	Reads the tables with all the implemented information into an <a id="workbookData">array</a>. 
</p>
<ul>
	<dl> 
		<dt>-valuesonly</dt>
		<dd>Read data only, no formatting</dd>
		<dt>-keylist</dt>
		<dd>Create a key list</dd>
		<dt>-sheets PATTERN</dt>
		<dd>Load only the specified table IDs</dd>
		<dt>-sheetnames PATTERN</dt>
		<dd>Load only the tables with the specified names</dd>
		<dt>-datefmt FORMAT</dt>
		<dd>Date format (default = "%Y-%m-%d %H:%M:%S")</dd>
		<dt>-as array</dt>
		<dd>Currently only array output</dd>
	</dl>
	<p>
		return workbookData 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> <b>constructor</b> args -creator CREATOR 
</p>
<ul>
	<dl> 
		<dt>-creator CREATOR</dt>
		<dd>Set author name</dd>
	</dl>
	<p>
		return class 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>numberformat</b> args 
</p>
<p>
	Creates an Excel number format (<a id="NUMFMTID">NUMFMTID</a>) for the current workbook. 
</p>
<ul>
	<dl> 
		<dt>-format FORMAT</dt>
		<dd>FORMAT can be any Excel format-string</dd>
		<dt>-general</dt>
		<dd>Excel general-format</dd>
		<dt>-date</dt>
		<dd>Date format</dd>
		<dt>-time</dt>
		<dd>Time format</dd>
		<dt>-datetime</dt>
		<dd>Date/Time format</dd>
		<dt>-iso8601</dt>
		<dd>Date/Time in ISO8601 notation</dd>
		<dt>-number</dt>
		<dd>Integer</dd>
		<dt>-decimal</dt>
		<dd>Decimal number with 2 decimal places</dd>
		<dt>-red</dt>
		<dd>Color red on negative values (can be combined with number and decimal)</dd>
		<dt>-separator</dt>
		<dd>Thousand separators (can be combined with number and decimal)</dd>
		<dt>-fraction</dt>
		<dd>Fractions</dd>
		<dt>-scientific</dt>
		<dd>Scientific numbers</dd>
		<dt>-percent</dt>
		<dd>Percentage</dd>
		<dt>-text|-string</dt>
		<dd>Text</dd>
	</dl>
	<p>
		return NUMFMTID 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>defaultdatestyle</b> <a href="#STYLEID"> STYLEID </a> 
</p>
<p>
	Set the style for the default date format (default=0) for the current workbook. 
</p>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>font</b> args 
</p>
<p>
	Create a <a id="FONTID">FONTID</a> with the following settings for the current workbook. 
</p>
<ul>
	<dl> 
		<dt>-list</dt>
		<dd>Returns the list of currently defined fonts, in stead of FONTID.</dd>
		<dt>-name NAME</dt>
		<dd>(default = "Calibri")</dd>
		<dt>-family FAMILY</dt>
		<dd>(defauft = 2)</dd>
		<dt>-size SIZE</dt>
		<dd>(default = 12)</dd>
		<dt>-color <a href="#COLOR"> COLOR</a></dt>
		<dd>(default = "theme 1")</dd>
		<dt>-scheme SCHEME</dt>
		<dd>(default = "minor")</dd>
		<dt>-bold</dt>
		<dd></dd>
		<dt>-italic</dt>
		<dd></dd>
		<dt>-underline</dt>
		<dd></dd>
		<dt>-color <a href="#COLOR"> COLOR</a></dt>
		<dd></dd>
	</dl>
	<p>
		return FONTID 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>fill</b> args 
</p>
<p>
	Create a <a id="FILLID">FILLID</a> with the following settings for the current workbook. 
</p>
<ul>
	<dl> 
		<dt>-list</dt>
		<dd>Returns the list of currently defined fills, in stead of FILLID.</dd>
		<dt>-patterntype <a href="#PATTERNTYPE"> PATTERNTYPE</a></dt>
		<dd>(default = "none")</dd>
		<dt>-fgcolor <a href="#COLOR"> COLOR</a></dt>
		<dd></dd>
		<dt>-bgcolor <a href="#COLOR"> COLOR</a></dt>
		<dd></dd>
	</dl>
	<p>
		return FILLID 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>border</b> args 
</p>
<p>
	Create a <a id="BORDERID">BORDERID</a> with the following settings for the current workbook. 
</p>
<ul>
	<dl> 
		<dt>-list</dt>
		<dd>Returns the list of currently defined borders, in stead of BORDERID.</dd>
		<dt>-leftstyle <a href="#BORDERLINESTYLE">BORDERLINESTYLE</a></dt>
		<dd></dd>
		<dt>-leftcolor <a href="#COLOR">COLOR</a></dt>
		<dd></dd>
		<dt>-rightstyle <a href="#BORDERLINESTYLE">BORDERLINESTYLE</a></dt>
		<dd></dd>
		<dt>-rightcolor <a href="#COLOR">COLOR</a></dt>
		<dd></dd>
		<dt>-topstyle <a href="#BORDERLINESTYLE"> ORDERLINESTYLE</a></dt>
		<dd></dd>
		<dt>-topcolor <a href="#COLOR"> COLOR</a></dt>
		<dd></dd>
		<dt>-bottomstyle <a href="#BORDERLINESTYLE">BORDERLINESTYLE</a></dt>
		<dd></dd>
		<dt>-bottomcolor <a href="#COLOR">COLOR</a></dt>
		<dd></dd>
		<dt>-diagonalstyle <a href="#BORDERLINESTYLE">BORDERLINESTYLE</a></dt>
		<dd></dd>
		<dt>-diagonalcolor <a href="#COLOR">COLOR</a></dt>
		<dd></dd>
		<dt>-diagonaldirection <a href="#DIAGONALDIRECTION">DIAGONALDIRECTION</a></dt>
		<dd></dd>
	</dl>
	<p>
		return BORDERID 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>style</b> args 
</p>
<p>
	Create a <a id="STYLEID">STYLEID</a> with the following settings for the current workbook. 
</p>
<ul>
	<dl> 
		<dt>-list</dt>
		<dd>Returns the list of currently defined styles, in stead of STYLEID.</dd>
		<dt>-numfmt <a href="#NUMFMTID">NUMFMTID</a></dt>
		<dd></dd>
		<dt>-font <a href="#FONTID">FONTID</a></dt>
		<dd>From method font.</dd>
		<dt>-fill <a href="#FILLID">FILLID</a></dt>
		<dd>From method fill.</dd>
		<dt>-border <a href="#BORDERID">BORDERID</a></dt>
		<dd>From method border.</dd>
		<dt>-xf XFID</dt>
		<dd>(default = 0) no method implemented yet</dd>
		<dt>-horizontal <a href="#HORIZONTAL">HORIZONTAL</a></dt>
		<dd></dd>
		<dt>-vertical <a href="#VERTICAL">VERTICAL</a></dt>
		<dd></dd>
		<dt>-rotate <a href="#DEGREE">DEGREE</a></dt>
		<dd></dd>
	</dl>
	<p>
		return STYLEID 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>worksheet</b> name 
</p>
<p>
	Creates a new <a id="sheet">woksheet</a> for the current workbook. 
</p>
<ul>
	<p>
		return sheet 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>column</b> <a href="#sheet"> sheet </a> args 
</p>
<p>
	Column definitions for the specified worksheet. 
</p>
<ul>
	<dl> 
		<dt>-index INDEX</dt>
		<dd></dd>
		<dd>(autoincrement of column if INDEX not applied)</dd>
		<dt>-to INDEX</dt>
		<dd></dd>
		<dt>-width WIDTH</dt>
		<dd></dd>
		<dt>-style <a href="#STYLEID"> STYLEID</a></dt>
		<dd></dd>
		<dt>-bestfit</dt>
		<dd></dd>
		<dt>-customwidth</dt>
		<dd></dd>
		<dt>-string</dt>
		<dd></dd>
		<dt>-nozero</dt>
		<dd></dd>
		<dt>-calcfit</dt>
		<dd></dd>
	</dl>
	<p>
		return column 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>row</b> <a href="#sheet"> sheet </a> args 
</p>
<p>
	Sets values for the new line or jumps to the line number for the specified worksheet. 
</p>
<ul>
	<dl> 
		<dt>-index INDEX</dt>
		<dd>(autoincrement of row if INDEX not applied)</dd>
		<dt>-height HEIGHT</dt>
		<dd></dd>
	</dl>
	<p>
		return row 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>cell</b> <a href="#sheet"> sheet </a> {data {}} args 
</p>
<ul>
	<dl> 
		<dt>-index INDEX</dt>
		<dd></dd>
		<dd>(autoincrement of column if INDEX not applied)</dd>
		<dt>-style <a href="#STYLEID"> STYLEID</a></dt>
		<dd></dd>
		<dt>-formula FORMULA</dt>
		<dd></dd>
		<dt>-string</dt>
		<dd></dd>
		<dt>-nozero</dt>
		<dd></dd>
		<dt>-globalstyle</dt>
		<dd></dd>
		<dt>-height HEIGHT</dt>
		<dd></dd>
	</dl>
	<p>
		return row,column 
	</p>
</ul>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>autofilter</b> <a href="#sheet"> sheet </a> indexFrom indexTo 
</p>
<p>
	Set autofilter for the specified worksheet. 
</p>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>freeze</b> <a href="#sheet"> sheet </a> index 
</p>
<p>
	Freeze panes for the specified worksheet. 
</p>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>presetsheets</b> <a href="#workbookData"> workbookData </a> 
</p>
<p>
	An Excel document read in with ::ooxml::xl_read with the known formats and data preassigned. 
</p>
<hr>
<p>
	<b>::ooxml::xl_write</b> method <b>write</b> filename 
</p>
<p>
	Writes the defined Excel document. 
</p>
<hr>
<p>
	<b>::ooxml::tablelist_to_xl</b> lb args 
</p>
<p>
	Exporting a tablelist to an Excel file. 
</p>
<ul>
	<dl> 
		<dt>-callback CALLBACK</dt>
		<dd>default CALLBACK: ::ooxml::tablelist_to_xl_callback</dd>
		<dd>Callback arguments: spreadsheet sheet maxcol column title width align sortmode hide</dd>
		<dt>-path PATH</dt>
		<dd></dd>
		<dt>-file FILENAME</dt>
		<dd></dd>
		<dt>-creator CREATOR</dt>
		<dd></dd>
		<dt>-name NAME</dt>
		<dd></dd>
		<dt>-rootonly</dt>
		<dd>export tablelist root nodes only</dd>
		<dt>-addtimestamp</dt>
		<dd>add timestamp to filename</dd>
		<dt>-globalstyle</dt>
		<dd>use / recognize global styles</dd>
	</dl>
</ul>
<p>
</p>
<p>
	CALLBACK sample and default: 
</p>
<verbatim>proc ::ooxml::tablelist_to_xl_callback { spreadsheet sheet maxcol column title width align sortmode hide } {
  set left 0
  set center [$spreadsheet style -horizontal center]
  set right [$spreadsheet style -horizontal right]
  set date [$spreadsheet style -numfmt [$spreadsheet numberformat -datetime]]
  set decimal [$spreadsheet style -numfmt [$spreadsheet numberformat -decimal -red]]
  set text [$spreadsheet style -numfmt [$spreadsheet numberformat -string]]

  if {$column == -1} {
    $spreadsheet defaultdatestyle $date
  } else {
    switch -- $align {
      center {
        $spreadsheet column $sheet -index $column -style $center
      }
      right {
        $spreadsheet column $sheet -index $column -style $right
      }
      default {
        $spreadsheet column $sheet -index $column -style $left
      }
    }
  }
}</verbatim>
<hr>

Z f5fec2bc374ece55d7c80140cc38282e