(I received your answer by e-mail. Thank you very much!
Now I repeat my question and add my coode)
I have question about Comment in Aspose.Excel.
I make following functionality:
It is import of data from xls-files to DB. Client prepare files for
import himself. My programm opens a file and reads data "cell by cell", if
expected value in a cell had wrong format or value I add comment to the
cell with text of error. After I propose open the file and to look at "why
the file is not correct for data import"
Problem: for some files (I do not know how the files were created...)
comments are added not correctly.
*** my code***
private void Button2_Click(object sender, System.EventArgs e)
excel = new Excel();
OpenExcel(ref excel, "D:\\Temp\\A.xls"); //test for local computer
Worksheet sheet = excel.Worksheets;
Cells cells = sheet.Cells;
int commentIndex = sheet.Comments.Add(2, 2);
comment = sheet.Comments[commentIndex];
comment.Note = "this is comment";
comment.Height = 2;
comment.Width = 5;
excel.Save("test.xls", FileFormatType.Default, SaveType.OpenInExcel, Response);
private static void OpenExcel(ref Excel excel, string falename)
excel = new Excel();//(strLicenseFile);
FileStream fs = new FileStream(falename, FileMode.Open, FileAccess.Read);
int fsLength = (int)fs.Length;
byte fsData =new byte[fsLength];
fs.Read(fsData, 0, fsLength);
MemoryStream ms = new MemoryStream(fsData);
I have got old version Aspose.excel (220.127.116.11). On those files I have
- Excel cannot open the file after an addition of comment (error: file
has errors, data maybe be lost. Then file open without any styles and
- I downloaded latest Aspose.Excel (18.104.22.168). Now file after addition of
comments is not damaged.
But there are errors:
- I do not see text in comment. Text appears only after set property
Width and Heigth > 5 cm for comment (I open the file in Office XP)
- I do not see comment-box...only arrow (if I try open the file in Office
My programm code is correct, because it works well for new xls-files that
is created myself in Excel.
How I can use comment so as to it works correctly for !!!any files?