¿Cuál es la diferencia entre CellValues.InlineString y CellValues.String en OpenXML?
Estoy tratando de escribir un código para generar una hoja de cálculo de Excel y no estoy seguro de cuál es la diferencia entre CellValues.InlineString y CellValues.String para insertar texto en las celdas.
Solo uso esto:
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);
}
est
private void UpdateCellTextValue(Cell cell, string cellValue)
{
cell.CellValue = new CellValue(cellValue);
cell.DataType = new EnumValue<CellValues>(CellValues.String);
}
o solo esto (InsertSharedStringItem devuelve el Id. del elemento de cadena compartido recientemente insertado)
private void SetCellSharedTextValue(Cell cell,string cellValue)
{
int stringId = InsertSharedStringItem(cellValue);
cell.CellValue = new CellValue(stringId.ToString());
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
}