[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

HIDE OOCALC FILE WHEN PRINTING

Hi All,

I print report to OOCalc.
I want to open it and still hide when printing.
Show it when finish printing.

How could I do it ?

Thank you.
0
emi_sastra
Asked:
emi_sastra
  • 5
  • 3
  • 2
1 Solution
 
emi_sastraAuthor Commented:
Hi CodeCruiser,

I think you missed my point.

Like we print to excel, we could open it without show the excel sheet until we set it visible.

  Set xlApp = CreateObject("Excel.Application")
    Set xlBook = xlApp.Workbooks.Add
    Set XLSheet = xlBook.Worksheets(1)

    xlApp.Visible = True

I wonder is there such a command for OOCalc.

Thank you.

0
 
CodeCruiserCommented:
Show the code that you are currently using then.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
emi_sastraAuthor Commented:
Please see below code.

  oServiceManager = CreateObject("com.sun.star.ServiceManager")
        oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop")
        oCalcDoc = oDesktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, aNoArgs)

        oSheet = oCalcDoc.getSheets().getByIndex(0)

        oCalcCtrl = oCalcDoc.getCurrentController()

        Dim oPageStyles As Object = oCalcDoc.StyleFamilies.getByName("PageStyles")
        Dim oDefault As Object = oPageStyles.getByName("Default")

Thank you.
0
 
CodeCruiserCommented:
Try playing with oDesktop.visible = False etc as there is no documentation for these classes.
0
 
emi_sastraAuthor Commented:
Yes, it is hard to find if there is.

Thank you.
0
 
ltlbearand3Commented:
FYI - the API documentation is at http://api.openoffice.org/docs/common/ref/com/sun/star/module-ix.html.  It is not the easiest to use, but it is there.

To hide your document while you work on it try something like this:
Dim objOOFrame As Object = objOODesktop.ActiveFrame
Dim objOOWindow As Object = objOOFrame.GetContainerWindow
objOOWindow.SetVisible(False)

Open in new window


Then to print use something like this:
Dim objPrintOps(0) As Object
objCalc.Print(objPrintOps)

Open in new window

0
 
emi_sastraAuthor Commented:
Hi ltlbearand3,

When we open the oocalc, it is open first and thus visible to user.
The code you provide then hide it.

Is there any option to hide it at open, or hide as default like excel ?.

Thank you.
0
 
ltlbearand3Commented:
emi_sastra,

There is a way to hide it at start up.  However, this was discourage in early versions of Open Office as it tended to cause issues when making changes to the document.  I have never tried it myself and don't have not read how it works in the current version.  Later this week I might be able to hunt around and try to find out how that was supposed to work and do a quick test.  However, the previous problems were noted to be intermittent so you may not know if it really works until you start using it for more than a simple test.  At this stage since I have not heard of anyone successfully using it that way, I would recommend staying with the method above.

-Bear
0
 
emi_sastraAuthor Commented:
Yes, I use the method you provide now.

Should I close this question or I should wait for the perfect one ?

Thank you.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now