wordpress hit counter
Cell format changes after 5 rows? - SpreadsheetML - Formats - OpenXML Developer

Cell format changes after 5 rows?

Formats

Discussions about working with different Open XML Formats

Cell format changes after 5 rows?

  • rated by 0 users
  • This post has 1 Reply |
  • 0 Followers
  • I am using an Excel Template file in VB.Net to create a spreadsheet populated from a dataset. The template file has one column that is formatted as Number. Looping through the dataset, I insert the current data into the cell formatting the value as and set the datatype of the cell to Number as shown below.

    cell.CellValue = New CellValue(String.Format("{0:f}", value))
    cell.DataType =
    New EnumValue(Of CellValues)(CellValues.Number)

    Beginning with the fifth row in the resulting spreadsheet, the format of the rest of the cells in that column are formatted as General instead of Number.

    Any ideas on why this would be happening?

  • I figured it out. The Template only contained five rows in the sheet1.xml. When I added the 6th row, since I wasn't specifying an existing style and format, it defaulted to General. I now add a style to the cell and it works as expected.
Page 1 of 1 (2 items)