Performance Issues on formatting methods

Hello,

I am testing the evaluation version of Aspose.Excel (fix .dll as attached in recent "=FIND" message) and I am experiencing a strange performance behaviour on the integration test environment: the application is really slow when creating an Excel file on the integration test but not when running on my notebook.

Using tracing messages I found out that the most time-consuming instructions are the "formatting" routines, most of all the Worksheet.AutoFitColumn (int columnIndex). It takes 20 seconds to execute the AutoFit for each column of an Excel of about 7300 rows. As the Excels can have as much as 20 columns, the time taken is not acceptable.

Also the other Style application routines are very heavy - in terms of time. This is the way I use them



(..)
Range number_format_range=
ws.Cells.CreateRange (
x,y,z,w);
style = excel.Styles[excel.Styles.Add()];
style.Custom = datatype_excel;
number_format_range.Style = style;
(...)

Another strange phenomenon is that the Integration test envorinment takes a lot of memory (as much as 110 MByte of RAM), while on my notebook it gets at most to 50 - 60 Mbytes and everything seems normal.

Can you help me to understand where the problem is?

Thank you

Luigi

Hi Luigi,

AutoFitColumn and style setting are time-consuming method but they shouldn’t be so slow.

Is there any difference in your programs running on your notebook and test machine? What’s the difference in the OS, .NET Framework or other software/hardware configuration?

Hi Laurence,

…got it: the test machine is a Pentium II 399 MHz !!!

(my notebook: Pentium 4 2,66 GHz)

thank you again,

Luigi

@luigi_salvini,
Aspose.Excel is discontinued and no more under active development now. It is replaced by Aspose.Cells that supports all the legacy features of its predecessor and also provides support for all the latest features in different versions of MS Excel. You can create ranges, merge cells in a range and format using variety of styles. Here is an example that demonstrates this feature:

// Instantiate a new Workbook.
Workbook wb1 = new Workbook();

// Get the first worksheet in the workbook.
Worksheet worksheet1 = wb1.Worksheets[0];

// Create a range.
Range mrange = worksheet1.Cells.CreateRange("A18", "J18");

// Name the range.
mrange.Name = "Details";

// Merge the cells of the range.
mrange.Merge();

// Get the range.
Range range1 = wb1.Worksheets.GetRangeByName("Details");

// Define a style object.
Style style = wb1.CreateStyle();
style.Font.IsBold = true;
style.Pattern = BackgroundType.Solid;
style.ForegroundColor = Color.Yellow;
// Set the alignment.
style.HorizontalAlignment = TextAlignmentType.Center;

// Create a StyleFlag object.
StyleFlag flag = new StyleFlag();
// Make the relative style attribute ON.
flag.HorizontalAlignment = true;

// Apply the style to the range.
range1.ApplyStyle(style, flag);

// Input data into range.
range1[0, 0].PutValue("Aspose");

// Save the excel file.
wb1.Save("mergingrange.out.xls");

The following document can be referred to for more information about merging and formatting cells:
Merge or Unmerge Range of Cells
Data Formatting
Format and Modify Named Ranges

Here you can download the latest free trial version:
Aspose.Cells for .NET (Latest Version)

Here is ready to run solution that can be used to test the product features without writing any code.