Java Uno Implementation of 'whole seet export' for calc pdf export


I for the life of me cannot figure out how to enable the whole sheet export option shown in the export pdf dialog in calc, using java uno or the command line api. I’ve tried

 pdfOptions[2] = new PropertyValue();
            pdfOptions[2].Name = "WholeSheet";
            pdfOptions[2].Value = true; 
 pdfOptions[2] = new PropertyValue();
            pdfOptions[2].Name = "WholeSheetExport";
            pdfOptions[2].Value = true; 

etc with no success: the output is again one page for each sheet (or multiple pages for each sheet)

Would be grateful for any hints in this regard!

can you share a minimum working code example?

An example in Basic.
Java examples here.

Option Explicit
' -----------------------------------------------------------------------------------------------------------------
' lang:en
' Exports the part of the oDoc specified by the oSel parameter to filePath (URL or operating system format).
' If oSel is not specified (or Nothing), then all sheets of the document are exported.
Sub ExportToPdf(ByVal oDoc As Object, ByVal filePath As String, Optional ByVal oSel As Object)
  Dim oSh
  Dim args(1) as new
  Dim aFilterData(0) as new
  If IsMissing(oSel) Then oSel=Nothing
  args(0).Name = "FilterName"
  args(0).Value = "calc_pdf_Export"
  If Not (oSel Is Nothing) Then
    args(1).Name = "FilterData"
    aFilterData(0).Name="Selection" : aFilterData(0).Value=oSel
    args(1).Value = aFilterData
  End If     
  oDoc.StoreToUrl ConvertToUrl(filePath), args
End Sub

' Export first sheet of ThisComponent to pdf.
Sub ExportFirstSheet()
  ExportToPdf ThisComponent, "C:\temp\Test.pdf", ThisComponent.Sheets(0)
End Sub

Neither WholeSheet nor WholeSheetExport are valid pdf export options. See Apache OpenOffice Community Forum - Determining PDF Export Options - (View topic) for a list of calc pdf export options.
I believe setting PageLayout to 1 is what you are looking for … but you have to try yourself

Good luck,


PDF CLI Parameters - it will appear in 7.6 help, as the result of tdf#147105.