Sep 09

Печать документов OpenOffice на java

Подробное описание по тематике “Печать документов OpenOffice на java” находил тут.
А вообще масса полезной инфы – там однако искать там что-то – сам черт ногу сломит.

некоторые полезные снипеты

1. Как установить ориентацию печати для документов OpenOffice на java

protected void storeDocComponent(XComponent xDoc, String storeUrl, boolean landscape) throws java.lang.Exception
{
    XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, xDoc);
    PropertyValue[] storeProps = new PropertyValue[0];
    if(landscape)
    {
        XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, xDoc);
        PropertyValue[] printerDesc = new PropertyValue[1];
        printerDesc[0] = new PropertyValue();
        printerDesc[0].Name = “PaperOrientation”;
        printerDesc[0].Value = PaperOrientation.LANDSCAPE;
        xPrintable.setPrinter(printerDesc);
    }
    xStorable.storeAsURL(storeUrl, storeProps);
}

2. Как установить формат печати для документов OpenOffice на java

protected void storeDocComponent(XComponent xDoc, String storeUrl, boolean landscape) throws java.lang.Exception
{
    XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, xDoc);
    PropertyValue[] storeProps = new PropertyValue[0];
    if(landscape)
    {
        XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, xDoc);
        PropertyValue[] printerDesc = new PropertyValue[1];
        printerDesc[0] = new PropertyValue();
        printerDesc[0].Name = “PaperFormat”;
        printerDesc[0].Value = com.sun.star.view.PaperFormat.A3;
        xPrintable.setPrinter(printerDesc);
    }
    xStorable.storeAsURL(storeUrl, storeProps);
}

разумеется, можно и в одной функции выставлять сразу несколько свойств печати

3. Как в OpenOffice подогнать документ в заданное число страниц

    ScaleToPages:=3;//подгоняем на 3 страницы

6 comments

2 pings

Skip to comment form

  1. Just where perhaps you have had found the source created for that write-up? Awesome checking I??ve subscribed for your personal blog feed.

  2. Wow, this is in every repecst what I needed to know.

  3. Nice post. I be taught one thing more challenging on different blogs everyday. It will all the time be stimulating to learn content from other writers and practice somewhat one thing from their store. I’d choose to use some with the content material on my weblog whether you don’t mind. Natually I’ll give you a link on your web blog. Thanks for sharing.

  4. thanks for share!

    1. Unparalleled accuracy, unequivocal clarity, and undenilabe importance!

  5. That’s way the bestest awnser so far!

  1. hey…

    I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate. Seeking forward to reading more from you later……

  2. Hallo…

    Ihre Seite gefällt mir! Schönes Design und sehr übersichtlich… Mit freundlichen Grüßen…

Leave a Reply

Your email address will not be published.