Andrew Douglas Pitonyak wrote:

> What happens if you do not load the document as hidden?

That would create a serious problem on my clients' systems, since I've
noticed that dramatically slows down the process (I don't use the GUI at
all and open a hidden instance of OOo from my program -- forgot the specs
that do that.)  I can test it on my own system when I get XP up and running
again, though.  It might be difficult to make that change for my client's
system since their boss is quite tight about the computers.  He has no
computer background so any change I make is met with suspicion about what
I'm trying to get past him.

What's odd is it only happens on this one computer -- but we all know if one
client has an issue, it could happen to others at some point.

I'll see what I can find on this and if I can get him to let me upload a
patched version and check it out.

Thanks!

Hal

> Hal Vaughan wrote:
>> I have a client who is using OOo 2.0 on Winodws XP as part of a Java
>> program
>> I've written.  I'd like to upgrade, but since my software has to install
>> my program and OOo -- and know where OOo is being installed to, it's
>> quite
>> difficult to upgrade my software every time OOo upgrades.  In other
>> words, using a later version is not a desirable solution, since it takes
>> me a day or two whenever I have to use the new OOo installer and make
>> sure everything works on both Linux and Windows.
>>
>> When she runs my program on her computer, it generates a number of .odt
>> or .sxw files.  Once generated these files could sit for a while or could
>> be used immediately for printing.  In this case, it turns out that when
>> we generate .sxw files, they're printing just fine, but any .odt files
>> are not
>> printing -- they show up as blank sheets of paper.  (In call cases the
>> files are only 1 page long so I have no way of checking the length of the
>> documents when they print.)  As if that weren't odd enough, if she runs
>> OOo and uses the GUI and loads them on her own and then prints them, they
>> print fine!
>>
>> In other words, when I load files through the Java API, if they're .sxw
>> they print, if they're .odt, a blank page prints instead, but loading any
>> of the files through the GUI allows them to print fine.
>>
>> This version of my program has worked on other XP systems previously. 
>> I'd test it myself, but my XP system is temporarily down and likely won't
>> be up until I can transfer data from the other partitions and put in a
>> new hard drive.
>>
>> I've included my Java code to open and print the OOo files below.
>>
>> I'm hoping someone will recognize this as something simple that I'm
>> overlooking or that there's an issue or bug that I just haven't been able
>> to find.  Whatever it is, any help is appreciated!
>>
>> Thanks!
>>
>> Hal
>> ------------------------------------
>> Open file:
>>
>> private void openDoc() {
>>         boolean bError = false;
>>         if (oooDoc != null) {
>>                 sysConfig.log("warning", "attempting to open a second
>>                 document: " +
>>                         fileName + ", current document: " + docURL);
>>                 return;
>>         }
>>         docURL = makeURL(fileName);
>>         PropertyValue[] oProps = new PropertyValue[1];
>>         oProps[0] = new PropertyValue();
>>         oProps[0].Name = "Hidden";
>>         oProps[0].Value = new Boolean(true);
>>         try {
>>                 oooDoc = oLoader.loadComponentFromURL(docURL, "_blank",
>>                 0, oProps);
>>         } catch (Exception  e) {
>>                 sysConfig.log("error", "Error: \"" + e + "\" in opening
>>                 document: " +
>>                         fileName);
>>                 bError = true;
>>         }
>>         if (!bError) docOpen = true;
>>         return;
>> }
>>
>> MakeURL:
>>
>> private String makeURL(String sFile) {
>>         if (sFile.startsWith("private:factory/s")) {return sFile;}
>>         if (sFile.startsWith("file:")) {return sFile;}
>>         while (sFile.startsWith("////")) {sFile = sFile.substring(1);}
>>         while (!sFile.startsWith("///")) {sFile = "/" + sFile;}
>>         if (sysConfig.getMode("ostype").toLowerCase().indexOf("windows")
>>         >= 0) {
>>                 sFile = sFile.replace('\\', '/');
>>         }
>>         sFile = "file:" + sFile;
>>         return sFile;
>> }
>>
>> Print a document:
>>
>> private void docPrinter () {
>>         int i = 0;
>>         if (sysConfig.getMode("printstate").equals("false")) {
>>                 return;
>>         }
>>         if (oooDoc == null) {
>>                 sysConfig.log("warning", "null doc, could not print: " +
>>                 docURL); return;
>>         }
>>         String sPrinter = sysConfig.getMode("printer");
>>         XPrintable oPrint = (XPrintable)
>>                 UnoRuntime.queryInterface(XPrintable.class, oooDoc);
>>         PropertyValue[] printOpts = new PropertyValue[2];
>>         PropertyValue[] checkOpts = null;
>>         printOpts[0] = new PropertyValue();
>>         printOpts[0].Name = "Name";
>>         printOpts[0].Value = sPrinter;
>>         printOpts[1] = new PropertyValue();
>>         printOpts[1].Name = "Wait";
>>         printOpts[1].Value = new Boolean(true);
>>         try {oPrint.setPrinter(printOpts);} catch (Exception e) {
>>                         sysConfig.log("error", "cannot print document: "
>>                         + docURL); return;
>>         }
>>         checkOpts = oPrint.getPrinter();
>>         for (i = 0; i < checkOpts.length; i++) {
>>                         if (checkOpts[i].Name.equals("Name")) {
>>                         if (!checkOpts[i].Value.equals(sPrinter)) {
>>                                 sPrinter = "<"+sPrinter+">";
>>                                 printOpts[i].Value = sPrinter;
>>                                 try {
>>                                         oPrint.setPrinter(printOpts);
>>                                 } catch (Exception e) {
>>                                         sysConfig.log("error", "cannot
>>                                         print document: " + docURL);
>>                                         return;
>>                                 }
>>                         }
>>                         break;
>>                 }
>>         }
>>         try {oPrint.print(printOpts);} catch (Exception e) {
>>                 sysConfig.log("error", "can't print document.  doc: " +
>>                 docURL); e.printStackTrace();
>>                 System.exit(0);
>>                 return;
>>         }
>>         return;
>> }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>   
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to