Style Primer PDF Print E-mail

A style represents a single combination of all the features found under “Format Cells” in MicroSoft’s Excel application.  For each unique combination, you must define a style number.  The style numbers are defined and used per XML Excel file creation.  If your XML file will have two or more sheets, you only need one Style section (which is done before the first worksheet in both your sqr and in the XML Exce file).  When you later write the cells (strings, numbers, dates, etc), you will reference the styles you create in this section.

The design for structuring styles is as follows:
  1. Call xml_init_style to start a new style definition.
  2. Call any or all of the xml_style procedures.  Skip the ones you don’t need.  (The coding will use the style id from the last “xml_init_style” procedure)
  3. Call xml_init_style to start the next style.
  4. Call xml_finalize_style when you have finished defining all the styles to be used in the current Excel file.

 

Example (from SQR2XML – but can be changed to work for PC2XML)

do xml_init_style(0)
do xml_style_alignment('', 'Bottom', 0, 0)

! Main Centered Headings

do xml_init_style(21)
do xml_style_alignment('CenterAcrossSelection', 'Bottom', 0, 0)
do xml_style_font('Arial', 18, 1)

! Main Column Headings that are Centered Across Selection

do xml_init_style(22)
do xml_style_alignment('CenterAcrossSelection', 'Bottom', 0, 0)
do xml_style_font('Arial', 10, 1)
do xml_style_border('Top', 'Continuous', 1)
do xml_style_interior('#C0C0C0', 'Solid')

let #xmls_dt = 100
let #xmls_dt_bl = 101
let #xmls_dt_br = 102
let #xmls_dt_bb = 103
let #xmls_dt_blb = 104
let #xmls_dt_brb = 105
let #xmls_dt_bbb = 106

do xml_init_style(#xmls_dt)
do xml_style_font('Arial', 10, 0)
do xml_init_style(#xmls_dt_bl)
do xml_style_font('Arial', 10, 0)
do xml_style_border('Left', 'Continuous', 1)
do xml_init_style(#xmls_dt_br)
do xml_style_font('Arial', 10, 0)
do xml_style_border('Right', 'Continuous', 1)
do xml_init_style(#xmls_dt_bb)
do xml_style_font('Arial', 10, 0)
do xml_style_border('Bottom', 'Continuous', 1)
do xml_init_style(#xmls_dt_blb)
do xml_style_font('Arial', 10, 0)
do xml_style_border('Left', 'Continuous', 1)
do xml_style_border('Bottom', 'Continuous', 1)
do xml_init_style(#xmls_dt_brb)
do xml_style_font('Arial', 10, 0)
do xml_style_border('Right', 'Continuous', 1)
do xml_style_border('Bottom', 'Continuous', 1)
do xml_init_style(#xmls_dt_bbb)
do xml_style_font('Arial', 10, 0)
do xml_style_border('Bottom', 'Double', 1)


do xml_finalize_style()


 
Follow us on Twitter
RocketTheme Joomla Templates