XlsxWorksheet class

Member functions

Constructor

new XlsxWorksheet(workbook[XlsxWorkbook object], name (optional)[string])

Description

Create a new XlsxWorksheet object for writing xlsx files.

Arguments

  • workbook (XlsxWorkbook object)

    The workbook to create the worksheet in.

  • name (optional) (string)

    The name of the worksheet. If omitted the default names 'Sheet1', 'Sheet2' etc will be used.

    Returns

    XlsxWorksheet object

    Return type

    XlsxWorksheet

    Example

    To create a new worksheet in workbook

    var worksheet = new XlsxWorksheet(workbook);

    Details of functions

    AddImage(row[integer], column[integer], filename[string], x_scale (optional)[real], y_scale (optional)[real])

    Description

    Add an image to the Xlsx file. Note that the image will not actually be read/inserted until the workbook is written by calling XlsxWorkbook.Close so you must make sure the image file exists until then.

    Arguments

  • row (integer)

    The row in the xlsx file (rows start at zero)

  • column (integer)

    The column in the xlsx file (columns start at zero)

  • filename (string)

    Name of the image file you want to add to the xlsx file. The image can be in png or jpeg format.

  • x_scale (optional) (real)

    Scale factor for horizontally scaling the input image.

  • y_scale (optional) (real)

    Scale factor for vertically scaling the input image.

    Returns

    No return value

    Example

    To add image 'C:/temp/test.png' to XlsxWorksheet worksheet on the second row, third column:

    worksheet.AddImage(1, 2, 'C:/temp/test.png');
          


    AddNumber(row[integer], column[integer], value[number])

    Description

    Add number to the Xlsx file

    Arguments

  • row (integer)

    The row in the xlsx file (rows start at zero)

  • column (integer)

    The column in the xlsx file (columns start at zero)

  • value (number)

    Number you want to add to the xlsx file

    Returns

    No return value

    Example

    To add number 1.2345 to XlsxWorksheet worksheet on the second row, third column:

    worksheet.AddNumber(1, 2, 1.2345);


    AddText(row[integer], column[integer], text[string])

    Description

    Add text to the Xlsx file

    Arguments

  • row (integer)

    The row in the xlsx file (rows start at zero)

  • column (integer)

    The column in the xlsx file (columns start at zero)

  • text (string)

    Text you want to add to the xlsx file

    Returns

    No return value

    Example

    To add text 'test' to XlsxWorksheet worksheet on the second row, third column:

    worksheet.AddText(1, 2, 'test');


    SetColumnProperties(column[integer], width[number])

    Description

    Set the column properties in the worksheet

    Arguments

  • column (integer)

    The column in the xlsx file (columns start at zero)

  • width (number)

    Width of the column to set

    Returns

    No return value

    Example

    To set the width of the third column in XlsxWorksheet worksheet to 30:

    worksheet.SetColumnProperties(2, 30);


    SetRowProperties(row[integer], height[number])

    Description

    Set the row properties in the worksheet

    Arguments

  • row (integer)

    The row in the xlsx file (rows start at zero)

  • height (number)

    Height of the row to set

    Returns

    No return value

    Example

    To set the height of the third row in XlsxWorksheet worksheet to 20:

    worksheet.SetRowProperties(2, 20);