I use EPPlus to export excel 2007 file. The file can export normally but i have some problem with setting column format. My string column with numeric style (Purchase Order No. ex. 49000001) be exported with green tag on the top left of the each cell, How can i remove it?
I try to set number format to "General" but it's not work
Please help.
p.s i use C#
this code works
private void removingGreenTagWarning(ExcelWorksheet template1, string address)
{
var xdoc = template1.WorksheetXml;
//Create the import nodes (note the plural vs singular
var ignoredErrors = xdoc.CreateNode(System.Xml.XmlNodeType.Element, "ignoredErrors", xdoc.DocumentElement.NamespaceURI);
var ignoredError = xdoc.CreateNode(System.Xml.XmlNodeType.Element, "ignoredError", xdoc.DocumentElement.NamespaceURI);
ignoredErrors.AppendChild(ignoredError);
//Attributes for the INNER node
var sqrefAtt = xdoc.CreateAttribute("sqref");
sqrefAtt.Value = address;// Or whatever range is needed....
var flagAtt = xdoc.CreateAttribute("numberStoredAsText");
flagAtt.Value = "1";
ignoredError.Attributes.Append(sqrefAtt);
ignoredError.Attributes.Append(flagAtt);
//Now put the OUTER node into the worksheet xml
xdoc.LastChild.AppendChild(ignoredErrors);
}
use it as
removingGreenTagWarning(template1, template1.Cells[1, 1, 100, 100].Address);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With