Free Support Forum - aspose.com

Excel warning about possible data losses after modyfing excel document

There is a sample:

Aspose.Excel.License lic = new Aspose.Excel.License();

lic.SetLicense("Aspose.Custom.lic");

Aspose.Excel.Excel exc = new Aspose.Excel.Excel();

exc.Open("mamba.xls");

Aspose.Excel.Worksheet worksheet = exc.Worksheets[0];

for(int i = 0; i < 10; i++)

{

Aspose.Excel.Cell cell = worksheet.Cells[i, 0];

cell.Style.ForegroundColor = System.Drawing.Color.Yellow;

int j = worksheet.Comments.Add(i, 0);

Aspose.Excel.Comment comment = worksheet.Comments[j];

comment.Note = "somecomment";

}

exc.Save("mamba.xls");

If i save document in another file - it works fine. After running this sample i have message box when openening modified document in excel. Document in attach.

Could you please tell me how this file is created? I found this file is strange. I copied data from your file and paste them into a new file. Then all work fine. Please check this file.

Your file works fine. My file was created by copying data from another file by russian version of exel.

I'll test it on english version...

Problem is not in excel document. Problem in aspose.

Document broken by adding two comments in the same cell. I think aspose must throw exception in such case...

The way to reproduce is:

static void Main(string[] args)

{

Aspose.Excel.License lic = new Aspose.Excel.License();

lic.SetLicense("Aspose.Custom.lic");

Aspose.Excel.Excel exc = new Aspose.Excel.Excel();

exc.Open("mamba.xls");

Aspose.Excel.Worksheet worksheet = exc.Worksheets[0];

for(int i = 0; i < 30; i++)

{

Aspose.Excel.Cell cell = worksheet.Cells[i, 0];

cell.Style.ForegroundColor = System.Drawing.Color.Yellow;

int j = worksheet.Comments.Add(i, 0);

Aspose.Excel.Comment comment = worksheet.Comments[j];

comment.Note = "МАМБА";

comment.Font.Size = 8;

comment.Font.Name = "Times New Roman Cyr";

comment.Width = 3;

comment.Height = 4;

j = worksheet.Comments.Add(i, 0);

comment = worksheet.Comments[j];

comment.Note = "МАМБА";

comment.Font.Size = 8;

comment.Font.Name = "Times New Roman Cyr";

comment.Width = 3;

comment.Height = 4;

}

exc.Save("mamba.xls");

}

I found another bug. When I use Aspose.Excel.License.SetLicense(Stream ss) - there is no exception if stream is empty.

This is not very well, becouse when I use another signature i have exception if argument is wrong.

Thanks for your suggestion.

Could you please tell me what you mean "stream is empty"?

Sorry. I mean stream is null

Currently if you set null parameter in SetLicense method, we consider you set the component to evaluation mode.