Hi,
I have created several reports with Aspose Excel that have worked fine until recently. I have worked out that if there are too many records/rows in the output file, although the XLS saves ok, it crashes Excel when I attempt to open it. I have tried creating the designer file with Excel 2000 and Excel XP, and have replicated the problem on several other computers. Is this a know issue? Is it an issue with the eval version??
Thanks,
Alex.
Dear Alex,
Thanks for your consideration.
Could you send me your designer file and the test code?
I have fixed this. I was setting cell styles within a loop on a cell. As soon as I put the cell style commands outside this loop, it worked. Thanks anyway.
@alexidm.au,
Aspose.Excel is replaced by a more advanced version as Aspose.Cells. You can set the style and many other properties as demonstrated in the following sample code.
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Accessing the "A1" cell from the worksheet
Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Defining a Style object
Aspose.Cells.Style style;
// Get the style from A1 cell
style = cell.GetStyle();
// Setting the vertical alignment
style.VerticalAlignment = TextAlignmentType.Center;
// Setting the horizontal alignment
style.HorizontalAlignment = TextAlignmentType.Center;
// Setting the font color of the text
style.Font.Color = Color.Green;
// Setting to shrink according to the text contained in it
style.ShrinkToFit = true;
// Setting the bottom border color to red
style.Borders[BorderType.BottomBorder].Color = Color.Red;
// Setting the bottom border type to medium
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Medium;
// Applying the style to A1 cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "book1.out.xls");
For more details have a look at the following article:
Format Cells using GetStyle and SetStyle Methods
Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)
You can download the latest demos here.