We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Leading apostrophe not always exported

Hello,

we are using Aspose.cells.dll to export string value to Excel, due to some reason, we add a leading apostrophe to every string, this apostrophe is invisible in cell, but visible in format window, and this is expected.

The problem is we found not every string has this leading apostrophe in format window after being exported, it seems there is a pattern, in that only every second line has this leading apostrophe, please check the problem using attached .xlsx

when focusing on description column, t1, t3, t5 do have a leading apostrophe, but t2, t4, t6 do not.

is this a problem in Aspose.Cells.dll?



Thanks,

Xin

Hi Xin,


Thank you for contacting support. Please try our latest fix/version and let us know how that goes on your side:

Aspose.Cells for .NET v17.3.6 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.3.6 (.NET 4.0) compiled in .NET Framework 4.0.

If this does not resolve the problem, then please provide us your source Excel file and code for the testing purposes. It will help us to replicate the same problem on our side. We shall then investigate and reply you appropriately. Your response is awaited.

Hi Xin,


In reference to the above query, please try the following source code and let us know how that goes on your side.

[.NET, C#]
// load an Excel file
Workbook sourceWorkbook = new Workbook(path + “testplan4.xlsx”);
// get collection of cells
Cells cells = sourceWorkbook.Worksheets[0].Cells;
// iterate through the cells
foreach (Cell cell in cells)
{
if (cell.GetStyle().QuotePrefix)
{
Console.WriteLine(cell.Name + " : " + ("’" + cell.StringValue));
}
else
{
Console.WriteLine(cell.Name + " : " + cell.StringValue);
}
}

Hi lmran,


Thanks for the information, i have downloaded the latest release (17.3.0), and the problem still exists,
i also tried using the console program to check the cell style, for those with hidden ', the cell.GetStyle().QuotePrefix will return true, while for others, cell.GetStyle().QuotePrefix will return false.

Thanks,
Xin

Hi,


Thanks for your posting and using Aspose.Cells.

We have tested your issue with the following sample code which is same as above however, it only prints cells of column A and found, its console output is correct.

C#
// load an Excel file
Workbook sourceWorkbook = new Workbook(“testplan4.xlsx”);
// get collection of cells
Cells cells = sourceWorkbook.Worksheets[0].Cells;
// iterate through the cells
foreach (Cell cell in cells)
{
if (cell.Column > 0)
continue;

if (cell.GetStyle().QuotePrefix)
{
Console.WriteLine(cell.Name + " : " + ("’" + cell.StringValue));
}
else
{
Console.WriteLine(cell.Name + " : " + cell.StringValue);
}
}//for each

Console Output
A1 : Change Status
A2 : '—
A3 : —
A4 : '—
A5 : —
A6 : '—
A7 : —

Hello,


Thanks for the help so far,
Currently the problem looks like occurred during writing to Excel cells, i will try to simplify the problematic code and create a small program to demonstrate the issue, as the original application is big, this will take quite some time, will back to you when finish.

Thanks again!
Xin

Hi,


Thanks for your posting and using Aspose.Cells.

Yes, it will be great help for us, if you could isolate the issue and provide us some simple Excel file and sample code that we could run at our end and replicate your issue. Thanks for your cooperation in this regard and have a good day.