Page 1 of 1

[Solved] Spreadsheet as JPEG: not all columns exported

PostPosted: Tue Sep 11, 2018 9:07 am
by olk
Hi,
I'd like to export an spreadsheet to JPEG.
Unfortunately only 7 of 17 columns are exported in the JPEG file.
I'd like to know if it's possible to remove the padding? The JPEG should only contain the table without space at it's borders?

I guess that some PropertyValue's are missing ... but I can't figure out which one.

The function for exporting the spreadsheet looks like this:


Code: Select all   Expand viewCollapse view
void
export_document_jpeg( Reference< XMultiServiceFactory > const& xMainComponent, std::string const& documentFile) {
    Reference< XStorable > xStore{ xMainComponent, UNO_QUERY };
    Sequence< PropertyValue > filterParameters{ 3 };
    filterParameters[0].Name  = OUString::createFromAscii("PixelWidth");
    filterParameters[0].Value <<= (sal_uInt32) (1654);
    filterParameters[1].Name  = OUString::createFromAscii("PixelHeight");
    filterParameters[1].Value <<= (sal_uInt32) (2338);
    filterParameters[2].Name  = OUString::createFromAscii("Quality");
    filterParameters[2].Value <<= (sal_uInt32) (100);
    Sequence< PropertyValue > storeProps{ 3 };
    storeProps[0].Name = OUString::createFromAscii("Overwrite");
    storeProps[0].Value <<= (bool)(true);
    storeProps[1].Name = OUString::createFromAscii("FilterName");
    storeProps[1].Value <<= OUString::createFromAscii("writer_jpg_Export");
    storeProps[2].Name  = OUString::createFromAscii("FilterData");
    storeProps[2].Value <<= filterParameters;
    xStore->storeToURL( OUString::createFromAscii( documentFile.c_str() ), storeProps);
}

Thank you in advance.
Oliver

Re: Spreadsheet as JPEG: not all columns exported

PostPosted: Thu Sep 20, 2018 11:40 am
by LilZebra
Have you tried selecting all rows & columns that you want to export? Then selecting...

Format > Print Ranges > Define ?

Re: Spreadsheet as JPEG: not all columns exported

PostPosted: Thu Sep 20, 2018 12:45 pm
by olk
Setting property ScaleToPages to `1` fixed this issue.