[Solved] Spreadsheet as JPEG: not all columns exported

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] Spreadsheet as JPEG: not all columns exported

Postby olk » Tue Sep 11, 2018 9:07 am

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
Last edited by robleyd on Thu Sep 20, 2018 3:08 pm, edited 2 times in total.
Reason: Added green tick [robleyd, Moderator]
OpenOffice 4 on Arch Linux
olk
 
Posts: 8
Joined: Mon Sep 10, 2018 2:37 pm

Re: Spreadsheet as JPEG: not all columns exported

Postby LilZebra » Thu Sep 20, 2018 11:40 am

Have you tried selecting all rows & columns that you want to export? Then selecting...

Format > Print Ranges > Define ?
LibreOffice 6.1.3.2 (Linux Fedora 26 on x86_64) with 'Notebookbar'
OpenOffice.org since 2002-12. LibreOffice user since 2013-current.
HSQLDB 2.4
User avatar
LilZebra
 
Posts: 43
Joined: Sun Mar 06, 2016 4:27 pm
Location: Canada

Re: Spreadsheet as JPEG: not all columns exported

Postby olk » Thu Sep 20, 2018 12:45 pm

Setting property ScaleToPages to `1` fixed this issue.
OpenOffice 4 on Arch Linux
olk
 
Posts: 8
Joined: Mon Sep 10, 2018 2:37 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest