diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/IXLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/IXLCell.cs
index 8bc0903..01b546c 100644
--- a/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/IXLCell.cs
+++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/IXLCell.cs
@@ -34,8 +34,25 @@
///
XLCellValues DataType { get; set; }
+ ///
+ /// Sets the type of this cell's data.
+ /// Changing the data type will cause ClosedXML to covert the current value to the new data type.
+ /// An exception will be thrown if the current value cannot be converted to the new data type.
+ ///
+ /// Type of the data.
+ ///
IXLCell SetDataType(XLCellValues dataType);
+ ///
+ /// Sets the cell's value.
+ /// If the object is an IEnumerable ClosedXML will copy the collection's data into a table starting from this cell.
+ /// If the object is a range ClosedXML will copy the range starting from this cell.
+ /// Setting the value to an object (not IEnumerable/range) will call the object's ToString() method.
+ /// ClosedXML will try to translate it to the corresponding type, if it can't then the value will be left as a string.
+ ///
+ ///
+ /// The object containing the value(s) to set.
+ ///
IXLCell SetValue(T value);
///
@@ -85,17 +102,15 @@
///
TimeSpan GetTimeSpan();
- IXLRichText GetRichText();
-
///
/// Clears the contents of this cell (including styles).
///
- void Clear();
+ IXLCell Clear();
///
/// Clears the styles of this cell (preserving number formats).
///
- void ClearStyles();
+ IXLCell ClearStyles();
///
/// Deletes the current cell and shifts the surrounding cells according to the shiftDeleteCells parameter.
@@ -120,6 +135,10 @@
///
IXLRange AsRange();
+
+ ///
+ /// Gets or sets the cell's style.
+ ///
IXLStyle Style { get; set; }
///
@@ -130,10 +149,46 @@
///
Boolean ShareString { get; set; }
+ ///
+ /// Inserts the IEnumerable data elements and returns the range it occupies.
+ ///
+ /// The IEnumerable data.
IXLRange InsertData(IEnumerable data);
+
+ ///
+ /// Inserts the IEnumerable data elements as a table and returns it.
+ /// The new table will receive a generic name: Table#
+ ///
+ /// The table data.
IXLTable InsertTable(IEnumerable data);
+
+ ///
+ /// Inserts the IEnumerable data elements as a table and returns it.
+ /// The new table will receive a generic name: Table#
+ ///
+ /// The table data.
+ ///
+ /// if set to true it will create an Excel table.
+ /// if set to false the table will be created in memory.
+ ///
IXLTable InsertTable(IEnumerable data, Boolean createTable);
+
+ ///
+ /// Creates an Excel table from the given IEnumerable data elements.
+ ///
+ /// The table data.
+ /// Name of the table.
IXLTable InsertTable(IEnumerable data, String tableName);
+
+ ///
+ /// Inserts the IEnumerable data elements as a table and returns it.
+ ///
+ /// The table data.
+ /// Name of the table.
+ ///
+ /// if set to true it will create an Excel table.
+ /// if set to false the table will be created in memory.
+ ///
IXLTable InsertTable(IEnumerable data, String tableName, Boolean createTable);
XLHyperlink Hyperlink { get; set; }
diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs
index 8c1471c..620bd4e 100644
--- a/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs
+++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs
@@ -225,11 +225,6 @@
return GetValue();
}
- public IXLRichText GetRichText()
- {
- return RichText;
- }
-
public string GetFormattedString()
{
string cValue = FormulaA1.Length > 0 ? String.Empty : _cellValue;
@@ -658,15 +653,16 @@
}
}
- public void Clear()
+ public IXLCell Clear()
{
AsRange().Clear();
+ return this;
}
- public void ClearStyles()
+ public IXLCell ClearStyles()
{
- var newStyle = new XLStyle(this, _worksheet.Style) {NumberFormat = Style.NumberFormat};
- Style = newStyle;
+ Style = _worksheet.Style;
+ return this;
}
public void Delete(XLShiftDeletedCells shiftDeleteCells)
diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/IXLRangeBase.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/IXLRangeBase.cs
index 817bee7..f976f56 100644
--- a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/IXLRangeBase.cs
+++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/IXLRangeBase.cs
@@ -217,8 +217,8 @@
Boolean IsEmpty();
Boolean IsEmpty(Boolean includeFormats);
- IXLPivotTable CreatePivotTable(IXLCell targetCell);
- IXLPivotTable CreatePivotTable(IXLCell targetCell, String name);
+ //IXLPivotTable CreatePivotTable(IXLCell targetCell);
+ //IXLPivotTable CreatePivotTable(IXLCell targetCell, String name);
//IXLChart CreateChart(Int32 firstRow, Int32 firstColumn, Int32 lastRow, Int32 lastColumn);
}
diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeBase.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeBase.cs
index 95e04a9..10c058d 100644
--- a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeBase.cs
+++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeBase.cs
@@ -1220,18 +1220,18 @@
// return chart;
//}
- IXLPivotTable IXLRangeBase.CreatePivotTable(IXLCell targetCell)
- {
- return CreatePivotTable(targetCell);
- }
+ //IXLPivotTable IXLRangeBase.CreatePivotTable(IXLCell targetCell)
+ //{
+ // return CreatePivotTable(targetCell);
+ //}
public XLPivotTable CreatePivotTable(IXLCell targetCell)
{
throw new NotImplementedException();
}
- IXLPivotTable IXLRangeBase.CreatePivotTable(IXLCell targetCell, String name)
- {
- return CreatePivotTable(targetCell, name);
- }
+ //IXLPivotTable IXLRangeBase.CreatePivotTable(IXLCell targetCell, String name)
+ //{
+ // return CreatePivotTable(targetCell, name);
+ //}
public XLPivotTable CreatePivotTable(IXLCell targetCell, String name)
{
throw new NotImplementedException();
diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs
index 265b4b9..e4feeb1 100644
--- a/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs
+++ b/ClosedXML/ClosedXML/ClosedXML_Examples/Misc/DataTypes.cs
@@ -180,6 +180,19 @@
// To view all shared strings (all texts in the workbook actually), use the following:
// workbook.GetSharedStrings()
+ ws.Cell(++ro, co)
+ .SetDataType(XLCellValues.Text)
+ .SetDataType(XLCellValues.Boolean)
+ .SetDataType(XLCellValues.DateTime)
+ .SetDataType(XLCellValues.Number)
+ .SetDataType(XLCellValues.TimeSpan)
+ .SetDataType(XLCellValues.Text)
+ .SetDataType(XLCellValues.TimeSpan)
+ .SetDataType(XLCellValues.Number)
+ .SetDataType(XLCellValues.DateTime)
+ .SetDataType(XLCellValues.Boolean)
+ .SetDataType(XLCellValues.Text);
+
ws.Columns(2, 3).AdjustToContents();
workbook.SaveAs(filePath);
diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/PivotTables/PivotTables.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/PivotTables/PivotTables.cs
index 8990336..b36a956 100644
--- a/ClosedXML/ClosedXML/ClosedXML_Examples/PivotTables/PivotTables.cs
+++ b/ClosedXML/ClosedXML/ClosedXML_Examples/PivotTables/PivotTables.cs
@@ -19,11 +19,11 @@
ws.Cell("B3").Value = 150;
ws.Cell("B4").Value = 75;
- var pivotTable = ws.Range("A1:B4").CreatePivotTable(ws.Cell("D1"));
- pivotTable.RowLabels.Add("Category");
- pivotTable.Values.Add("Number")
- .ShowAsPctFrom("Category").And("A")
- .NumberFormat.Format = "0%";
+ //var pivotTable = ws.Range("A1:B4").CreatePivotTable(ws.Cell("D1"));
+ //pivotTable.RowLabels.Add("Category");
+ //pivotTable.Values.Add("Number")
+ // .ShowAsPctFrom("Category").And("A")
+ // .NumberFormat.Format = "0%";
wb.SaveAs(filePath);
}
diff --git a/ClosedXML/ClosedXML/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx b/ClosedXML/ClosedXML/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx
index a6b3eda..2d07295 100644
--- a/ClosedXML/ClosedXML/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx
+++ b/ClosedXML/ClosedXML/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx
Binary files differ