views:

42

answers:

1

I'm trying to print out a .doc-File with com4j. This is my Code:

document.printOut2000(true, false, WdPrintOutRange.wdPrintAllDocument, newDocumentPath, _, _, WdPrintOutItem.wdPrintDocumentContent, 1, _, WdPrintOutPages.wdPrintAllPages, true, true, _, false, 0, 0, 0, 0);

I got the values from a recorded Word-Macro and http://msdn.microsoft.com/en-us/library/microsoft.office.tools.word.document.printout(v=VS.80).aspx

But all i get is the following error:

An unexpected error has been detected by Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x770f48f9, pid=3792, tid=5996

Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode, sharing windows-x86) Problematic frame: C [OLEAUT32.dll+0x48f9]

Any idea how i can solve this?

Edit: Com4j is opening the document, so I think the results of the previous methods aren't the problem, but thanks to DTH for the hint.

A: 

Access Violation has often to do with a memory problem, for example buffer overwrite or even a null pointer. I would suggest you to check your code again and control the results of the methods you are using to prepare the document before printing, so you can see if they are working correct.

I'm not really sure about that, but try it, maybe it's the solution to your problem.

DTH
No, the results of the methods are ok. Also com4j ist opening the document, so this seems not to be the problem.
Tronje182