LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

MSWORD9.OLB appears unexpectedly in several word reports generated by CVI apps

We have two C programs that read layout data from an Excel sheet. Query a database for results and then write

a report in Word. For some reports we randomly get the text in red below appearing. By random I mean we havent

got an explanation for it. If I close everything down and re-run the program the text will appear in exactly the same place.

If I run the same program but generate a report based on different data the report will print as expected.

 

We have Windows XP SP2. Office 2000 (Word & Excel 2000 9.0.8968 SP3) 

CVI is 8.5.1

 

Has anyone else seen the same thing ? Have we broken some golden rules for opening or closing Word documents from CVI?

 

Chris 

 

 

R4.1 Cable Terminating Shelf                                                 29ETE41550AAA          08382200093                            07                              Fibre Terminating Shelf                                                          29PWS00002ACP          08382200036                            01                              C:\Program Files\Microsoft Office\Office\MSWORD9.OLB    29ESU41001AAA          08372200059                            07                              2 Conductor Earth Isolation PBA                                            29YPB20006AFL          08322370027                            04                              Motorised Rheostat 1                                                              29CRS21005AAM          08382200032                            02                              Motorised Rheostat 2 
0 Kudos
Message 1 of 9
(4,617 Views)

Is it possible that your database query for the item in question is returning "no data found", but the subsequent data pointers are not being checked for this, resulting in them pointing to some arbitrary string that just happens to be in memory somewhere? Or perhaps the format of this particular data item is not exactly as you expect. Maybe you need to beef up the error checking in this area.

 

JR

0 Kudos
Message 2 of 9
(4,597 Views)

Hi Chris,

The file you are calling appears to be an object file could you explain your application in more detail please and also provide any relevant error codes produced.

Now you said that the text appears, do you mean it appears in the code or the document file?

Have you observed your code as you singly step through the programme each line and command one by one?

Regards
Jordan Power
Applications Engineer
National Instruments
0 Kudos
Message 3 of 9
(4,568 Views)

Hi Jordan,

My name is Nilesh and i am a software developer working with chris. I wrote a program that uses word2000.fp file from labwindows to generate a word document. But sometimes we noticed that it prints a text " C:\Program Files\Microsoft Office\Office\MSWORD9.OLB" instead of the real text that needs to be printed. When i debugged the process i found that when it calls the function Word_SelectionTypeText (currSelHandleL, NULL, text)) the variable "text" contains the right text that needs to be printed but when i look at the word document it has printed the line i wrote above instead of original text. This behaviour is not consistent sometimes it happens and sometime it doesn't. I have created a function that i call from my program to print the text. That function is as below.

HRESULT CVIFUNC WordRpt_AppendText(CAObjHandle docHandle, char *text)
{
    HRESULT error = S_OK;
    CAObjHandle appHandleL = 0;
    CAObjHandle currSelHandleL = 0;

    errChk (Word_GetProperty (docHandle, NULL, Word_DocumentApplication,
                              CAVT_OBJHANDLE, &appHandleL));
    errChk (Word_GetProperty (appHandleL, NULL, Word_ApplicationSelection,
                   CAVT_OBJHANDLE, &currSelHandleL));
    errChk(Word_SelectionTypeText (currSelHandleL, NULL, text));


Error:
    CA_DiscardObjHandle(currSelHandleL);
    CA_DiscardObjHandle(appHandleL);

    return error;
}

 

It does not produce any error code everything that it does is prints " C:\Program Files\Microsoft Office\Office\MSWORD9.OLB" in word document instead of the real text that we passed to this function.

0 Kudos
Message 4 of 9
(4,544 Views)

Hi Nilesh,

 

If the issue only seems to happen randomly, it could be said that the code is not to fault. But the problem could occur with the system itself.

By this I mean there could be a conflict caused by another programme or application or even a background programme, i.e. An active X or virus scan engine could be trying to access the file at the same instant you are running you code.

 

I would suggest looking at the task manager to see what is running as the code is stepped through, and turn of/ disable any unnecessary background programmes that could possibly cause the conflict.

 

Regards

Jordan Power
Applications Engineer
National Instruments
0 Kudos
Message 5 of 9
(4,509 Views)

Hi Jordan,

Thanks for your reply. I tried turning antivirus off but with no luck. Is it possible for you to have a netmeeting session with me so i can show you what the problem exactly is? The text appears on same location everytime. If i debug the project and go trhough that line it prints that extra text instead of original text but when i  set the next statement to the same line of code again it prints the right text second time. Could not understand the behavoiur. If it is possible for you to have a netmeeting with me and chris then it would be great. Please let me know if you are ok with that. 

 

Nilesh

0 Kudos
Message 6 of 9
(4,497 Views)

Hi Nilesh,

Im sorry I cant arrange that as it is not a resource we support but phone support is available with SSP and also you would be able to call the main office on 01635 523545  and arrange for a Field Engineer to visit and work with your issue.

 

Sorry for the inconvenience, 

Regards

 

Jordan Power
Applications Engineer
National Instruments
0 Kudos
Message 7 of 9
(4,493 Views)
Hello,
Did you find a solution to your problem.
I would be very interested in this one because I have exactly the same concern

thank you
0 Kudos
Message 8 of 9
(4,199 Views)

Hi tesvd,

 

There are a couple of resolutions for this issue. They may sound a little strange but they appear to work: Currently there is an open CAR# 60948 about this problem and I cannot give you a resolution time for when this will be fixed. All I can suggest is that you look at the Readme file of the next release of CVI and see if this CAR number appears. If it is listed, then the issue has been resolved.

 

Here are the two workarounds:

 

There are two work arounds that we were able to find.
1) Try changing the following line (if applicable):
sprintf(printinfo,"    %d\t\t   %4.1f\t\t %4.1f",i, stepvalues,stepvalues);
Change the string to have a lot of following spaces such as this:
sprintf(printinfo,"    %d\t\t   %4.1f\t\t %4.1f                        ",i, stepvalues,stepvalues);

 
2) On my Vista 64 machine, and on my XP 32 machine, if the path (including the name of the executable) was longer than 81 characters, I never encountered the breakpoint exception. On my Vista 64 machine, if the path (again including the name of the exe) was longer than 121 characters, I didn't see either the breakpoint exception, or the text replacement. This did not hold true for the XP machine, as the text replacement was not happening at 120 characters - I did not narrow it down any further than this.

 

I hope this helps.

Andrew McLennan
Applications Engineer
National Instruments
0 Kudos
Message 9 of 9
(4,174 Views)