0 Replies Latest reply: Jun 19, 2014 8:12 AM by Gustav Gager RSS

    Macro to print sheet with background

    Gustav Gager

      Hi everyone. Im trying to do the simplest thing with a Macro, but it seems to be impossible to get it exactly like i want it.

       

      What i want is to print one sheet including the background (in my case to a PDF file).

       

      If i use this:
      $o_document.activesheet.print

      Then it print the sheet just fine, just without the background.

       

      Then i tried this:

      $o_document.activesheet.printout(true)
      Then it checks the "draw background" checkbox. But this time it gives me the printer dialog. And if i just press "print", then everything works exactly as it should.

       

      I have also tried changing the settings to the printersettings using:

      $o_DocumentProperties = $o_document.GetProperties

      $o_DocumentPrinterProperties = $o_DocumentProperties.PrintSheetSettings

      $o_DocumentPrinterProperties.SheetPrintDrawBackGround = true

      $o_document.SetProperties($o_DocumentProperties)

       

      yet again. It works if i use printout, but that give me a print dialogbox. And if i just use print, it prints fine, but without the background.

      Anyone have any idees or suggestions?

       

      I have looked trough the API guide, but it doesnt help me.