I am using OPENXML SDK 2.0 to stream the spread sheet file. The source data is come from data table and writing this to Spreadsheet using openxml. If there is a one of the column data of a data table has " Treshold%" (this text has tab space on it preceding) and the same being written excel but which is writing it to "Treshold%" in excel cell and removing the tab space.
I am using the code as below. Using workSheetWriter.PasteText
and workSheetWriter.PasteValue
methods.
WorksheetWriter workSheetWriter = new WorksheetWriter(spreadSheet, workSheet);
int intValue = 0;
if (strValue.Contains("$"))
{
strValue = strValue.Replace("$", "");
strValue = strValue.Replace(",", "");
workSheetWriter.PasteValue(cellLocation, strValue, CellValues.Number);
}
else if (int.TryParse(strValue, out intValue))
{
workSheetWriter.PasteValue(cellLocation, strValue, CellValues.Number);
}
else if (string.IsNullOrEmpty(strValue))
{
workSheetWriter.PasteText(cellLocation, strValue);
}
else
{
workSheetWriter.PasteText(cellLocation, strValue);
}
Please help on this. How can write the value which a tab space in the begining ( Treshold%) into excel cell as same format ?