My code is very simple, and not all users have this problem.
Hi Lu,
First of all, please accept my sincere apologies for not mentioning that the tests were carried out on core i7 1.73 with Windows 7 Home Premium 64-bit installed, while using the Aspose.Cells for .NET 7.7.2.2 assemblies.
Providing a logging/debug assembly may not be an easy task but we can surely log a request for the development team in this regard. Firstly, we want to make sure that your source code is perfectly optimized and does not have any performance related loop holes. In order to further investigate this matter, we would request you again to please provide a copy of your application or a sample replicating your complete scenario so we could thoroughly study it on our end before suggesting any improvements. Moreover, we may also require the environment details of your server to study the behavior of your application when its deployed and serve real time requests.
If you are concerned about the privacy of your data/source code then I would like to reassure that we need such data/sample/code just to replicate a particular scenario on our end, and we delete the customer provided information/data/sample/source as soon as problem is resolved.
Hi, my brother, this is all my test code and pc info, pls test.
may be, there is somthing wrong with “Style”.
Hi Lu,
Thank you for providing the sample application for our review.
I have evaluated your presented scenario/project on my end, and have noticed that maximum processing time is consumed by the following code snippet where you are iterating over the cells to put the value, applying style and auto fitting rows,
C#
Aspose.Cells.Cell cell = null;
DataRow dr;
for (int i = 0; i < 1500; i++)
{
dr = dt.Rows[i];
for (int j = 0; j < 10; j++)
{
cell = ws.Cells[i, j];
cell.PutValue(dr[j]);
cell.SetStyle(wb.Styles[idx]);
}
ws.AutoFitRow(i);
}
If you replace the above statements with the following code snippet, you will notice better performance with same results (attached).
C#
Please note, if you have the data in a DataTable, simplest and most efficient way is to import it using the statement Cells.ImportDataTable. Moreover, rather than iterating over all the cells to apply the style, you can create a range of all cells having data, and apply the style on each cell of the range with single call as Range.ApplyStyle.
I have attached a few snapshots of my results as well as the modified Form1.cs file (please remove the extension .txt) for your review.
hello, i know what you say. but you lose my question. In my sample project, if i use AutoFitRows(int), it tooks even more 15 minutes, if i don’t use this function, it tooks 30 seconds.
Hi Lu,
Thank you for writing back.
I have logged an investigative ticket (CELLSNET-42445) in our bug tracking system to look further into the performance related issue of AutoFitRow(int rowIndex) method, as I have noticed that un-commenting the last statement from the below provided code snippet decreases the execution time to a great deal.
C#
DataRow dr;
for (int i = 0; i < 1500; i++)
{
dr = dt.Rows[i];
for (int j = 0; j < 10; j++)
{
cell = ws.Cells[i, j];
cell.PutValue(dr[j]);
cell.SetStyle(wb.Styles[idx]);
}
//Un-commenting below statement increases the execution time
//from 769 to 6682 milliseconds
// ws.AutoFitRow(i);
}
Please spare us little time to properly analyze the cause on our end. In the meanwhile, we will keep you posted with updates in this regard.
Thank you very much. When “.SetStyle()” and “.AutoFitRow()” appear together, then the function “AutoFitRow(int)” take up a lot of time.
If i use “SetStyle” or “AutoFitRow” alone, it’s very fast. So i think there’s somthing wrong with them, “.SetStyle()” and “AutoFitRow(int)” .
Only a few people have this issue.
Only a few people have this issue.
Only a few people have this issue.
Hi Lu,
Thank you for your valuable observation.
I have verified the scenario on my end, and therefore logged your comments to the ticket already attached with this thread for thorough investigation. As soon as some news comes in, we will post here for your kind reference.
Hi,
Yes, they have not enough permissions to access the fonts directory.
Hi,
What should i do?
Hi Lu,
We are looking in the matter to propose a solution but please note that Aspose.Cells for .NET APIs
require Full Trust permissions set in order to access registry entries and font directories. Please check out the below linked technical article for your kind reference.
http://www.aspose.com/docs/display/cellsnet/Declaration
How to get all permissions?
Thank you very much. babar.raza
Hi Lu,
Full trust means that your application needs all rights that the .NET framework provides. Application developers declare which trust level their application needs in order to be able to run, this is known as “Code Access Security”. Code access security is a way of telling the compiler via attributes which kind of operation your code needs in order to succeed. These attributes are set into the application configuration files depending upon the application type. Please read more details about Security in the .NET Framework. If you are developing an ASP.NET application, please also check the technical article for ASP.NET Trust Levels.
Thank you for your write back.
Hi Lu,
All relevant details have already been shared in the previous post. Please go through the reference documents in order to get acquainted with Trust Levels and Code Access Security.
If you find any difficulty, please provide more details about your application, its type, deployment procedure and how it serves your customers.
Hi,
Please download and try our latest fix/version: Aspose.Cells for .NET v7.7.2.5
The issues you have found earlier (filed as CELLSNET-42445) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.