Tutorials

Tutorial

Text formatting

Deutsche Version

Font size, name and color

The code is shown only partly, the complete code is in the zip-file.

DECLARE
  -- test_20.sql
  v_fileHandle            utl_file.FILE_TYPE;

  r_font                  xml_spreadsheet.t_rec_font;
  r_customStyles          xml_spreadsheet.t_rec_customStyles;
  
  tab_customStyles        xml_spreadsheet.t_tab_customStyles;

BEGIN
    r_customStyles.id           := 's50';
    r_customStyles.type         := 'Text';
    r_font.fName                := 'Times New Roman';
    r_font.fSize                := 8;
    r_customStyles.font         := r_font;
    tab_customStyles(1)         := r_customStyles;
...
    r_customStyles.id           := 's55';
    r_font.fName                := 'Arial';
    r_font.fSize                := 10;
    r_font.fColor               := xml_spreadsheet.c_blue;
    r_customStyles.font         := r_font;
    tab_customStyles(6)         := r_customStyles;
...
    r_customStyles.id           := 's61';
    r_font.fColor               := 'blue';
    r_customStyles.font         := r_font;
    tab_customStyles(12)        := r_customStyles;


  -- New File
  v_fileHandle   := xml_spreadsheet.createNewFile('DOC','test_20.xml');
  -- open first worksheet

  xml_spreadsheet.newWorksheet(
       v_fileHandle
      ,'Textvariations'
      );

  -- Write a data row
  -- Font Size
  xml_spreadsheet.writeData(v_fileHandle,'Times New Roman 8pt','s50');
  xml_spreadsheet.writeData(v_fileHandle,'Times New Roman 10pt','s51');
  xml_spreadsheet.writeData(v_fileHandle,'Times New Roman 12pt','s52');
  xml_spreadsheet.writeData(v_fileHandle,'Times New Roman 14pt','s53');
  xml_spreadsheet.writeData(v_fileHandle,'Times New Roman 16pt','s54');
  -- New data row
  xml_spreadsheet.newDatarow(v_fileHandle);
  -- Font Color
  xml_spreadsheet.writeData(v_fileHandle,'Arial Blue','s55');
  xml_spreadsheet.writeData(v_fileHandle,'Arial Red','s56');
  xml_spreadsheet.writeData(v_fileHandle,'Arial Green','s57');
...

  -- close worksheet
  xml_spreadsheet.closeWorksheet(
       v_fileHandle
      ,0
      );

  -- Close file
  xml_spreadsheet.closeFile(v_fileHandle);

END;
/
Results for Test 20
ExcelOO-Calc
MS-Excel Output für Test 20 OO-Calc Output für Test 20

Click on images to enlarge

Differences

  • Excel accepts for color also names like 'red', in output file in line 4. OO-Calc ignores them.