From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why do Word and Excel reports run very slowly - CVI

We have two applications that write MS Word and Excel reports from CVI. These reports run at different speeds. On one PC the Word report will run quickly (20 seconds) and the Excel report will be slow (3 minutes) on another PC this can be reversed. Strangley moving the mouse while the report is running can speed up the report generation noticeably. We make sure that any Word and Excel files the user may have on their PC are closed before the CVI generated reports run.

 

Platform is CVI 8.5.1. Windows XP SP2 and Office 2000 SP3.

I have another posting regarding random appearance of MSWORD9.OLB in the same reports.

 

Chris

0 Kudos
Message 1 of 4
(3,068 Views)

Hi Chris,

I’m looking into this issue for you but first need you to clarify a few things.

 

When you say two applications that run word and excel reports do you mean two applications that generate both a word and excel report, or do you mean one application generating a word report, and one application generating an excel report?

Are you only seeing this behavior on specific PC's or does it happen on every PC that you have tested?

Also is the problem consistent on a single PC (does one PC always run the word report fast, while another PC always runs the excel fast, or is it random where either the word or the excel run fast and the other slow?)

How are you monitoring the speed of the report generation?

Are there many other applications running on the PC while the application is running?

What is the CPU usage while the reports are generated?

What sort of size documents are you creating?

 

If you can let me know this information I can have a better look at this issue for you.

 

Kind Regards, 

 

John P

AE

NI

------
John.P | Certified LabVIEW Architect | NI Alliance Member
0 Kudos
Message 2 of 4
(3,035 Views)

Hi John

 

There are two separate programs that produce firstly a word report and then an excel report.

 

The behaviour is different on different PCs but I have not been able to spot a pattern.

I have a laptop with 1Gb Ram and Pentium M 1.73GHz.

The word report prints first and I can seen the document open on my screen and the 3 or 4 pages are created in around 10 seconds. After which the document prints and then Word closes.

Then the Excel report is generated. Excel opens and the first page is created in a few seconds. When it gets to the second page the speed slow right up. I can see the layout scaling as more pages are added. Processor load goes to 100%. This is made up of 50% Excel and 38%

spoolsv plus other smaller tasks. Ram is only 50% used

 

On my colleagues desktop PC Intel Core 2 6300 1.86GHz and 2Gb RAM. The Word report generates very slowly (about 3 minutes) but wiggling the mouse around causes it to speed up. Processor use is only 10% or so. RAM 25%. Excel generates the report quickly - about 20 seconds.

 

The documents being produced are up to 4 A4 pages. Text only no graphics.

 

Other applications running are typical office apps. MS Outlook, McAfee anti virus.

 

Chris

0 Kudos
Message 3 of 4
(3,006 Views)

Hi Chris,

This is rather a strange problem.  I am thinking the most likely cause of this is something to do with your code architecture.

Can you give me a brief pseudo code outline of how you are generating the reports?

In the loop are you simply outputting a line of data on each iteration?

Or on each iteration do you open, update and close the file?

Have you tried stepping through the code to see which parts specifically are causing the issue?

A suggestion I do have is to add some timing to your loop.  As the CPU is going to 100% it suggests the computer will be struggling to perform other tasks whilst the application is running.  The queuing up of these tasks could be causing or at least be contributing towards the slowdown.  I suggest adding a simple ms wait function into the loop that is generating the report.  Once this is added see if the CPU usage is still up at 100% while the report is generating.

Let me know how you get on with these suggestions,

Kind Regards,

JohnP

AE

NI

------
John.P | Certified LabVIEW Architect | NI Alliance Member
0 Kudos
Message 4 of 4
(2,980 Views)