KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to write some code to generate an Excel spreadsheet and I am not sure what the difference between CellValues.InlineString and CellValues.String to insert text on the cells. Shall I use this: private void UpdateCellTextValue(Cell cell,string cellValue) { InlineString inlineString = new InlineString(); Text cellValueText = new Text { Text = cellValue }; inlineString.AppendChild(cellValueText); cell.DataType = CellValues.InlineString; cell.AppendChild(inlineString); } this private void UpdateCellTextValue(Cell cell, string cellValue) { cell.CellValue = new CellValue(cellValue); cell.DataType = new EnumValue<CellValues>(CellValues.String); } or just this (InsertSharedStringItem returns the Id of the newly inserted shared string item) private void SetCellSharedTextValue(Cell cell,string cellValue) { int stringId = InsertSharedStringItem(cellValue); cell.CellValue = new CellValue(stringId.ToString()); cell.DataType = new EnumValue<CellValues>(CellValues.SharedString); }
Tags (comma-separated)
Save Edits
Cancel