Free Support Forum - aspose.com

Opening 'Format -> Style...' causes Excel to Crash

I am creating a spreadsheet based on a designer spreadsheet. I set the styles of serveral ranges in the document to styles that exist in the designer spreadsheet. The spreadsheet is then saved. Opening the newly created document and clicking on "Format -> Style..." causes Excel to crash. Any help would be much appreciated. Thanks.

-- Joel

Hi Joel,

Which version of Aspose.Cells are you using? Could you please post your designer spreadsheet and sample code here? I will check them ASAP.

Thanks for the quick response. I'm using version 3.9.0.0. The designed excel document is attached. Here is the sample code I'm using to generate the Excel file. Thanks for all your help.

using System.IO;
using Aspose.Cells;

namespace ClassLibrary1
{
public class Class1
{
public void ExportStyleBug()
{
Workbook workBook = new Workbook();
using (FileStream templateStream = new FileStream(“MediaPlanStyleBugTest.xls”, FileMode.Open, FileAccess.Read, FileShare.Read))
{
workBook.Open(templateStream);
}

		Range r1 = workBook.Worksheets[0].Cells.CreateRange(0, 0, 1, 1);
		r1.Style = workBook.Styles["MonthRow1"];
		r1[0, 0].PutValue("0");
		
		workBook.Save("MediaPlanStyleBugTest_Output.xls");
	}
}

}

Thanks for your report. I find this problem and will fix it soon.

Please try this attached fix.

That fixes the test cases that I have. Thanks a ton.

-- Joel