Aspose.Cells wrap the terms between triple double quotes

554 views Asked by At

Using Aspose.Cells I need a csv file with my terms wraped between double quotes. For some reason the terms after the first column are surrounded by triple double quotes when saving my csv file, like: """term"""

This is my code:

WorkbookDesigner wd = new WorkbookDesigner();
wd.Workbook.Initialize();
Worksheet sht = wd.Workbook.Worksheets[0];
string value = "term";
value = string.Format("\"{0}\"", value);
sht.Cells[row + rowOffset, column].PutValue(value);
wd.Save(fileLoc, FileFormatType.CSV);

I'm using Aspose.Cells version 4.8.0.0

2

There are 2 answers

4
shakeel On BEST ANSWER

If you want to get a CSV file with your term as

"term"

then you should save it in your CSV file as

"""term"""

Please type

"""term"""

in a notepad and save it as .csv file. Now open it in Microsoft Excel and see its value, you will find it is displayed as

"term"

Note: I am working as Developer Evangelist at Aspose

0
Jeronimo Backes On

In CSV, the escape sequence for the quote character is 2 quote characters.

You are writing the value "term" (with quotes). Because of that (your value has quotes), the library will enclose the value with quotes, so you will end up with """term""".

To make it less confusing and more visible, try writing the value: some " term ": blah. This should be printed as:

"some ""term"": blah"