Replies: 11 comments
-
|
Hi, thanks for the sample application. Do you have issues with any particular APIs, or the use of NetOffice in general? From the numbers output in the sample application I cannot tell what's going on. |
Beta Was this translation helpful? Give feedback.
-
Using |
Beta Was this translation helpful? Give feedback.
-
|
@jozefizso i use only excel API at the moment. The output shows only seconds of each thread, how long it takes to read/write the 100x100 cells. @maliutin do you have a simple example how to avoid the for loop when using the range object? |
Beta Was this translation helpful? Give feedback.
-
|
For example: For colIdx As Integer = 1 To cols
For rowIdx As Integer = 1 To rows
newInputSheet.Cells(colIdx, rowIdx).Value = inputSheet.Cells(colIdx, rowIdx).Value
newInputSheet.Cells(colIdx, rowIdx).FormulaLocal = inputSheet.Cells(colIdx, rowIdx).FormulaLocal
Next
NextI suppose, in this case, we can use Cope method: Using inputCells = inputSheet.Cells,
inputLeftTopCell = inputCells(1, 1),
inputRightBottomCell = inputCells(rows, cols),
inputRange = inputSheet.Range(inputLeftTopCell, inputRightBottomCell)
Using newCells = newInputSheet.Cells,
newRange = newCells(1, 1)
inputRange.Copy(newRange)
End Using
End Using
|
Beta Was this translation helpful? Give feedback.
-
|
I see, this works for the simplicity of the program. In my main app I generate the excel first based from an xml file and after changing values in excel I transform this back to xml. I need to check each cell on value and formular. At least I got an idea how to work with array access May be this could be a way to improve performance on my main app. Nevertheless it doesn't explain why the NetOffice way is so much slower as the MS interop way. |
Beta Was this translation helpful? Give feedback.
-
In this case, you should allocate an additional part of the memory. It is often the situation when a user has Excel x86, several opened files in the same workspace and you need to process 50000x50000 cells. In result, you have a big risk to catch OutOfMemoryException in that line of the code. And I repeat the main idea: |
Beta Was this translation helpful? Give feedback.
-
|
While I agree that the suggestion to use Range and array based manipulation of multiple cell values is the way to go, I'd like to understand why OP is getting those results. NetOffice is supposed to be similar in performance to VB Late-binding according to this: https://netoffice.io/documentation/technical/performance.html @matteshe have you tried running it through the performance profiler and seeing where there delays some from? |
Beta Was this translation helpful? Give feedback.
-
|
Made these changes to
These were the results I got: |
Beta Was this translation helpful? Give feedback.
-
|
@ErrCode You did not implement one of the main points of NetOffice. |
Beta Was this translation helpful? Give feedback.
-
|
Understood. I'm merely curious. Looking at OP's code, both Since Excel should be doing exactly the same thing given the calls, then any timing difference could be attributed as the calling overhead from using the respective methods. Simply copying cell ranges from one sheet to another is probably not very realistic anyway (the technique of using I downloaded the code to NetOffice's original When I get some time, I'd like swap out the old NetOffice references for the |
Beta Was this translation helpful? Give feedback.
-
|
For future use and readers: NetOffice original performance tests has been made in ~2011. (as far i remember in .Net 2 and C#3) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I switch in my application from Microsoft Interop late binding usage to NetOffice. Unfortunatelly we are facing massive performance slowdown in excel generation and reading now.
I wrote a simple programm (ExcelApiPerformanceTests) to compare both ways of excel access. Furthermore I used 3 differnt ways of accessing the cells in order to find a fast solution. I attach my project, so that you can see the slow performance of netoffice. May be there is a faster compareable solution which I don't know. At least this way at the moment I need to go back to the Interop calls. :-/
I experience this with office 2010 and 2016.
Beta Was this translation helpful? Give feedback.
All reactions