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

Free Support Forum - aspose.com

How to escape a single doublequotes

Hello !

I have the same problem described here :

but I use v17.6 and I can’t change data file generation

Please help !

Br,

David

Hi David,

Could you provide us template CSV file and paste your sample code, we will check it soon.

Thank you.

Here is the code:

 //Instantiate LoadOptions
 TxtLoadOptions loadOptions = new TxtLoadOptions();
 loadOptions.Separator = '|';
 //Create a Workbook object and open the file from its path
 Workbook wb = new Workbook(@"C:\pathtocsv\test.csv", loadOptions);
 Worksheet ws = wb.Worksheets[0];

I can’t upload files so here is an exemple:

99|test 123
“99|test 1
99|test 123
99|test 123
99|test 123
99|test 123
99”|test 123
99|test 123

then check the value of ws.Cells[1,0]

and if there is a lot of data between the double quotes, you get the error
MS Excel only allows to put a string shorter than 32K to a Cell.

thank you

Hi,

Thanks for providing further details.

Please add a line to your code segment, it would work fine:
e.g
Sample code:

//Instantiate LoadOptions
TxtLoadOptions loadOptions = new TxtLoadOptions();
loadOptions.Separator = ‘|’;
loadOptions.CheckExcelRestriction = false;
//Create a Workbook object and open the file from its path
Workbook wb = new Workbook(@“C:\pathtocsv\test.csv”, loadOptions);
Worksheet ws = wb.Worksheets[0];

Let us know if you still have any issue.

Thank you.

Thank you for your quick answer.

I already tried this, and i get:

99|test 1
99|test 123
99|test 123
99|test 123
99|test 123
99

in ws.Cells[1,0]

Hi,

I got no exception when testing my simple template file with the following sample code. It prints the cell contents fine:
e.g
Sample code:

//Instantiate LoadOptions
TxtLoadOptions loadOptions = new TxtLoadOptions();
loadOptions.Separator = ‘|’;
loadOptions.CheckExcelRestriction = false;
//Create a Workbook object and open the file from its path
Workbook wb = new Workbook(“e:\test2\Bk_essinglequote.csv”, loadOptions);
Worksheet ws = wb.Worksheets[0];

        Cell cell = ws.Cells[1, 0];
        Console.WriteLine(cell.StringValue);

Could you provide your sample csv file, we will test your issue soon.

Thank you.

It says new users can’t upload documents :confused:

Hi,

Please use any third party service (e.g dropbox, google drive, etc.) to update your file there and share the download link here.

Thank you.

ok, there it is :
http://dl.free.fr/qJtMxLy6R

thanks

Hi,

Please try our latest version/fix: Aspose.Cells for .NET (Latest Version)

I have tested your scenario/ case using your template file and my sample code, it works fine and here is the console output which I get after running the code:

Console output:

99|test 1
99|test 123
99|test 123
99|test 123
99|test 123
99

The above output is fine. For confirmation, please open your file into notepad and you will see it extracts the cell’s content fine. For your information, the content starting with double quotes till its ending quotes is considered to be single cell’s content. This is same as MS Excel. So, this is not an issue by any means.

Thank you.

Hello,

Ok maybe it’s normal, but how I escape double quotes then. I want the value to be "99 then pass to the next cell. I don’t want all

99|test 1
99|test 123
99|test 123
99|test 123
99|test 123
99

in one cell

Hi,

I am afraid, there is not any automatic option/way available either in MS Excel or Aspose.Cells to escape double quotes @ your specified position (e.g in A2 cell) and split the rest data into next cells accordingly. Well, you got to cope with it by yourself either by using your own code (programmatically) or manually. For example, I think you may open your csv file into Notepad and manually insert ending double quotes after 99 and re-save the file:
e.g
you may try to change:
i.e.,

99|test 123
"99|test 1
99|test 123
99|test 123

to:

99|test 123
“99”|test 1
99|test 123
99|test 123

Thank you.

Ok thank you it is clear now. I will parse the file manually.

Thanks again