Using Formatting in SQL 2 Excel Pro PDF Print E-mail

SQL 2 Excel Pro has a formatting feature which allows you to control formatting of eny cell/range in your sheet.

You can control:

  • Font Type
  • Font Size
  • Font Color
  • Font Weight
  • Background Color
  • Border
  • Border Color
  • Number/Date Format
  • Alignment
  • Vertical Alignment
  • Word Wrap
  • Conditional formatting (see below)

The Format tab on the Worksheet page allows you to you to add as many cells/ranges as you need.

sqlformatting_sm

In the example above, we have defined two ranges. The first range defines 5 rows in column 1 where we set the number format to percent, and the font color to orange.  The second range is defined as a purple thin border aorund all cells.

Note how the border is added to the cells defined in range 1 as well. The orange numbers also have the border. The formatting is added sequentially. You can define overlapping ranges which makes it easier to define complex fromatting of irregular areas/cells.

sqlformatting_sheet


Specifying the range

You can specify the cell range as start row & col and stop row & col. Use integer numbers only - do not use letters.

You can use the {MINROWID} {MAXROWID} syntax (same as in formulas) - when defining the start/stop rows for smart allocation of the formatting.

Number/Date Format

The following number/date format codes can be used to specify the cell number/date format.

0 Decimal The amount of zeros specifies the amount of digits that will be shown
0.00 Decimal The amount of zeros after the decimal dot specifies the amount of decimal digits that will be shown
#.## Decimal The amount of sharp signs after the decimal dot specifies the maximum amount of decimal digits that will be shown
0% Percent The amount of zeros specifies the amount of digits that will be shown.
0.000% Percent The amount of zeros after the decimal dot specifies the amount of decimal digits that will be shown.
$#.#;[Red]($#.#) Currency Zeros and sharp signs have the same meaning as in other formats.
??/?? Fraction The amount of question signs in the denominator determines its precision (maximum amount of digits in the denominator).
# ??/?? Fraction A fraction with an integer part. Zeros and sharp signs are used for defining the integer part, and they have the same meaning as in other formats.
0.00E+# Scientific In scientific notation base and exponent are formated according to the same rules applied to decimals. For scientific notation zeros and sharp signs appear to be equivalent.
D-MMM-YY Date A date represented in the given notation. Month can be a one or two digits month, or a three letter month. Year can have 2 or 4 digits. The argument to be formated as a date is considered to be the number of days since December 30 1899 (Excel's day zero). For dates preceding day zero, negative numbers can be used.
D/M/YYYY h:mm:ss Date/Time A date represented in the given notation. The argument to be formated as a date is considered to be the number of days since Excel's day zero.
h:mm:ss AM/PM Time A time represented in the given notation. Be careful, the argument to be formated as a time has to be given in days. For example an argument of 0.5 would be presented as '12:00:00 PM'.



Conditional Formatting

You can define conditions for each format. The format will only be applied to the cells that matches the condition you specify. The following conditions can be specified:

  • Even Row Numbers
  • Odd Row Numbers
  • Even Column Numbers
  • Odd Column Numbers
  • Cell value is string
  • Cell value is not string
  • Cell value is numeric
  • Cell value is not numeric
  • Cell value is integer
  • Cell value is not integer
  • Cell value is empty
  • Cell value is not empty
  • Cell value = {some value}
  • Cell value >= {some value}
  • Cell value > {some value}
  • Cell value <= {some value}
  • Cell value < {some value}
  • Cell value <> {some value}
  • Cell value = {Result of SQL query}
  • Cell value >= {Result of SQL query}
  • Cell value > {Result of SQL query}
  • Cell value <= {Result of SQL query}
  • Cell value < {Result of SQL query}
  • Cell value <> {Result of SQL query}

Here's a simple example showing how to highlight the cell with the highest and the lowest value in a column. To do that we use two formats, one to highlight the maximum value with red text font and another format to highlight the minimum with blue. For both formats we use the Cell value = {Result of SQL query} condition. Click on the thumbnail image below to see how the formats are defined:

condformatting_setup_sm

The resulting spreadsheet is shown below. Note the third column, where the cells with minumum and maximum hits are highlighted in blue and red color.

condformatting_sheet_sm


In this simple example we only used text coloring for the conditional formatting. But any type of formatting can be controlled by the conditional rule, background color, border etc etc.


Known Issues

  • Using a lot of formatting requires more memory on the server and creates larger file sizes. You may run out of memory on the server if using formatting on very large spreadsheets. Use it with caution / check the PHP max process size configuration if you run into problems.

  • Only cells which have content can be formatted.

    Tip! You can an add extra cell with just a space in it if you want to apply formatting.

Comments (1)add comment

Roland said:

0
...
having trouble with UK currency am getting an A in front of the currency symbol?
 
February 04, 2010
Votes: +0

Write comment

security image
Write the displayed characters


busy
 
 
  Design by augs-burg.de & go-vista.de  
 
     
 
   
 

The Joomla!(R) name is used under a limited license from Open Source Matters in the United States and other countries. http://Joomla-R-Us.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.