diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs index c6fc7a9..8151246 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs @@ -6,7 +6,7 @@ namespace ClosedXML.Excel { - public enum XLCellValues { SharedString, Number, Boolean, DateTime } + public enum XLCellValues { Text, Number, Boolean, DateTime } public interface IXLCell: IXLStylized { diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs index dd39469..32c2c8e 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs @@ -37,7 +37,7 @@ if (val.Substring(0, 1) == "'") { val = val.Substring(1, val.Length - 1); - dataType = XLCellValues.SharedString; + dataType = XLCellValues.Text; } else if (Double.TryParse(val, out dTest)) { @@ -56,7 +56,7 @@ } else { - dataType = XLCellValues.SharedString; + dataType = XLCellValues.Text; } } cellValue = val; diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs index defbe68..0e69a5c 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs @@ -46,7 +46,7 @@ case XLCellValues.Boolean: return CellValues.Boolean; case XLCellValues.DateTime: return CellValues.Date; case XLCellValues.Number: return CellValues.Number; - case XLCellValues.SharedString: return CellValues.SharedString; + case XLCellValues.Text: return CellValues.SharedString; default: throw new NotImplementedException(); } } @@ -295,7 +295,7 @@ private void GenerateSharedStringTablePartContent(SharedStringTablePart sharedStringTablePart) { List combined = new List(); - Worksheets.ForEach(w => combined.AddRange(w.CellsCollection.Values.Where(c => c.DataType == XLCellValues.SharedString && c.Value != null).Select(c => c.Value).Distinct())); + Worksheets.ForEach(w => combined.AddRange(w.CellsCollection.Values.Where(c => c.DataType == XLCellValues.Text && c.Value != null).Select(c => c.Value).Distinct())); var distinctStrings = combined.Distinct(); UInt32 stringCount = (UInt32)distinctStrings.Count(); SharedStringTable sharedStringTable = new SharedStringTable() { Count = (UInt32Value)stringCount, UniqueCount = (UInt32Value)stringCount }; @@ -687,7 +687,7 @@ }; } CellValue cellValue = new CellValue(); - if (dataType == XLCellValues.SharedString) + if (dataType == XLCellValues.Text) { cellValue.Text = sharedStrings[opCell.Value.Value].ToString(); } diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs index 1d98573..5c0965d 100644 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs +++ b/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs @@ -86,15 +86,15 @@ ws.Cell(++ro, co).Value = "Date to Text:"; ws.Cell(ro, co + 1).Value = new DateTime(2010, 9, 2).ToString(); - ws.Cell(ro, co + 1).DataType = XLCellValues.SharedString; + ws.Cell(ro, co + 1).DataType = XLCellValues.Text; ws.Cell(++ro, co).Value = "Boolean to Text:"; ws.Cell(ro, co + 1).Value = true.ToString(); - ws.Cell(ro, co + 1).DataType = XLCellValues.SharedString; + ws.Cell(ro, co + 1).DataType = XLCellValues.Text; ws.Cell(++ro, co).Value = "Number to Text:"; ws.Cell(ro, co + 1).Value = "123.45"; - ws.Cell(ro, co + 1).DataType = XLCellValues.SharedString; + ws.Cell(ro, co + 1).DataType = XLCellValues.Text; ws.Cell(++ro, co).Value = "Text to Date:"; ws.Cell(ro, co + 1).Value = "'" + new DateTime(2010, 9, 2).ToString(); @@ -113,12 +113,12 @@ ws.Cell(++ro, co).Value = "Formatted Date to Text:"; ws.Cell(ro, co + 1).Value = new DateTime(2010, 9, 2).ToString(); ws.Cell(ro, co + 1).Style.NumberFormat.Format = "yyyy-MM-dd"; - ws.Cell(ro, co + 1).DataType = XLCellValues.SharedString; + ws.Cell(ro, co + 1).DataType = XLCellValues.Text; ws.Cell(++ro, co).Value = "Formatted Number to Text:"; ws.Cell(ro, co + 1).Value = "12345.6789"; ws.Cell(ro, co + 1).Style.NumberFormat.Format = "#,##0.00"; - ws.Cell(ro, co + 1).DataType = XLCellValues.SharedString; + ws.Cell(ro, co + 1).DataType = XLCellValues.Text; workbook.SaveAs(filePath); }