Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Unassigned: Changing a Column Header's text [9383]

$
0
0
I am trying to change the text of cells in the first row of the spreadsheet, essentially the column header.

This example is just changing the first cell in row 1.

```
Dim l_sValue As String
l_sValue = "test"
wb.Worksheets(0).Cell(1, 1).DataType = XLCellValues.Text
wb.Worksheets(0).Cell(1, 1).Value = l_sValue
```

However, when I do this the spreadsheet needs to be repaired when I open it. If I change any cell other than a cell in row 1 I have no issues.

I need to modify the column headers so they have a better meaning and can't do this in the DataTable that I am importing from.
Comments: Also I should Mention that I tried the following (Clearing the value first, and setting the datatype to String before setting the value) but still did not work ``` temp_ws.Cell(1, 1).Clear(); temp_ws.Cell(1, 1).DataType = XLCellValues.Text; temp_ws.Cell(1, 1).Value= "Label"; ```

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>