hello Laurence!
(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 excel;
excel = new Excel();
OpenExcel(ref excel, "D:\\Temp\\A.xls"); //test for local computer
Worksheet sheet = excel.Worksheets[0];
Cells cells = sheet.Cells;
Aspose.Excel.Comment comment;
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);
fs.Close();
excel.Open(ms);
ms.Close();
}
*************
I have got old version Aspose.excel (1.8.6.0). On those files I have
error :
- 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
comments)
- I downloaded latest Aspose.Excel (3.4.3.0). 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
2003)
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?
Ludmila.