Page 1 of 1

Export a spreadsheet as image (.jpg)

Posted: Tue Sep 23, 2014 9:50 pm
by GustavoPrograma
Hello guys, you are ok?
I have a problem and I need your help to solve it.

I need export a spreadsheet in image format, for someone can see it in a smartphone.

I'm trying to use draw pages to save it in .jpg format... But it search something as a graphic... I need convert a range of cells in a image. (the exported image don't have nothing, is all white and must be a cell range in the image)

Here is my code:

Code: Select all

sub img

Dim oFilter
Dim args(1) as new com.sun.star.beans.PropertyValue
oFilter=CreateUnoService("com.sun.star.drawing.GraphicExportFilter")
oFilter.setSourceDocument(ThisComponent.drawPages(0))
args(0).Name = "URL"                 'Where the file will be saved
args(0).Value = "file:///c:/Users/Gustavo Boladão/Desktop/bola.JPG" 'The destination URL
args(1).Name = "image"           'What type of file
args(1).Value = "jpeg"         'The file type
oFilter.filter(args())

end sub 
Could you help me? Thanks a lot guys!
IT'S URGENT!

Re: Export a spreadsheet as image (.jpg)

Posted: Tue Sep 30, 2014 5:47 pm
by MrProgrammer
GustavoPrograma wrote:I need export a spreadsheet in image format, for someone can see it in a smartphone.
No need for an evil macro: File → Export as PDF.

If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: Export a spreadsheet as image (.jpg)

Posted: Tue Sep 30, 2014 6:45 pm
by GustavoPrograma
Ok, is a great idea but what can I do for don't export the last spreadsheet?
I have 6 spreadsheets (0 to 5)... What method can I use to export only 0 to 4 (Spreadsheet 1,2,3,4 and 5)

Re: Export a spreadsheet as image (.jpg)

Posted: Tue Sep 30, 2014 8:05 pm
by Villeroy
1) Define print ranges that do not include the unwanted sheets.
2) Turn off automatic calculation, delete unwanted sheets, export and close without saving.

Re: Export a spreadsheet as image (.jpg)

Posted: Wed Oct 01, 2014 4:20 pm
by John_Ha
PrtScrn copies the PC screen to the clipboard (alt/PrtScrn copies the active window). Now paste it into an image editor and save as a PNG file.

Incidentally, never use JPG files for text as the lossy compression algorithm blurs the text edges and adds compression artefacts (the clue is in the P - it stands for Photographers!). PNG uses lossless compression and is ideal for graphics as opposed to photos (and the P now stands for Portable).

Re: Export a spreadsheet as image (.jpg)

Posted: Tue Mar 12, 2019 9:17 pm
by Phillip
If you just want to create a picture of part of a spreadsheet: Select, copy. Then paste into an Image editor like IrfanView and save it in whatever format you want.
Copy (Ctrl+C) again and then you can paste the image into another program.
I use this to copy part of a spreadsheet onto another - like the previous and next month in small type, under the larger current month for a monthly calendar.