Convert spreadsheet to jpeg

Convert spreadsheet to jpeg

am 20.06.2011 21:57:52 von AndrewMcHorney

Hello

I am not an expert in perl and so before I propose that a particular script be written I would likek to get an idea as to how hard the task would be.

We have a large number (in my opinion) of excel spreadsheets that need to be concerted to jpeg format. The jpeg files are used when a document is created and the jpeg files are inserted. The spreadsheets are under configuration control and the current policy is that when a spreadsheet is updated the jpeg file is created (via a macro) and it too goes under CM control. I am considering proposing that a perl script could go through the directory structure and save each spreadsheet to a jpeg file and it would be more efficient and cost effective.

Question:

1. How hard is it to write a perl script that will open a spreadsheet and save it to a jpeg file?
2,. Does this capability exist now?

Thanks,
Andrew

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Convert spreadsheet to jpeg

am 20.06.2011 22:31:55 von Rob Coops

--002354332aca7f2de704a62aa1c3
Content-Type: text/plain; charset=UTF-8

On Mon, Jun 20, 2011 at 9:57 PM, wrote:

> Hello
>
> I am not an expert in perl and so before I propose that a particular script
> be written I would likek to get an idea as to how hard the task would be.
>
> We have a large number (in my opinion) of excel spreadsheets that need to
> be concerted to jpeg format. The jpeg files are used when a document is
> created and the jpeg files are inserted. The spreadsheets are under
> configuration control and the current policy is that when a spreadsheet is
> updated the jpeg file is created (via a macro) and it too goes under CM
> control. I am considering proposing that a perl script could go through the
> directory structure and save each spreadsheet to a jpeg file and it would be
> more efficient and cost effective.
>
> Question:
>
> 1. How hard is it to write a perl script that will open a spreadsheet and
> save it to a jpeg file?
> 2,. Does this capability exist now?
>
> Thanks,
> Andrew
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>
Hi Andrew,

Opening a spreadsheet with perl is certainly a simple enough thing to do,
converting to a JPEG is a different story as far as I know as this would
require your perl code to be able to draw the excel documents content. As
far as I am aware this is not possible but I might be wrong. Now you might
be tempted to think that you could just execute the macro but that again
would require perl to fully understand the way MS visual basic works and has
access to all functions and methods that this visual basic does.

I think to be honest that in this case it is probably easier to create a
simple macro to open a specific directory or even a directory provided
trough a popup box, then open each excel file run a fixed macro in there,
safe the file and close the excel, rinse, repeat and you should have the
same thing as your perl script is supposed to do. As you are by the sound of
it creating another MS based document or maybe a PDF file which can be
created out of a MS based document which is then printed to a PDF... again
this can relatively easily be done with an VBA macro.

I know not very perly of me but I am one that believes in using a spade to
dig a hole and drill to drill one ;-)

Regards,

Rob

--002354332aca7f2de704a62aa1c3--

RE: Convert spreadsheet to jpeg

am 21.06.2011 16:13:55 von Tim Lewis

Here is some VBA code to get you started. It will run in an Excel =
spreadsheet. It opens another spreadsheet, copies the active cell data, =
pastes that to Paint, and saves the file as a jpg. I wrote it "on the =
fly", but it works. For production use, I would change it so that one =
sheet in the controlling spreadsheet contains the names of the other =
spreadsheets to open. I would add one worksheet to contain parameters =
such as the directory locations, and then call the parameters in. I =
never hard code parameters into the code except for quick samples. If =
the columns are expected to go beyond "Z", then you will need to add =
code to check for that.

Tim

Sub OpenAndSave()
processDirectory =3D "C:\Temp\"
processWorkbook =3D "myworkbook.xls"
Application.Workbooks.Open (processDirectory & processWorkbook)
=20
LastRow =3D =
LTrim(Str(Workbooks(processWorkbook).Sheets(1).UsedRange.Row s.Count))
LastColumn =3D =
Workbooks(processWorkbook).Sheets(1).UsedRange.Columns.Count
LastComumnString =3D Chr(LastColumn + 64) 'Change the ASCII number =
into a character
LastCell =3D LastComumnString & LastRow
Workbooks(processWorkbook).Sheets(1).Range("A1:" & LastCell).Select
=20
Selection.Copy
ExcelToJPG
Workbooks(processWorkbook).Close
=20

End Sub
Sub ExcelToJPG()
StorageDirectory =3D "C:\Temp\"
FileSaveName =3D StorageDirectory & Replace(ActiveWorkbook.Name, =
".xls", "") & ".jpg"
=20
=20
objPaint =3D "C:\WINDOWS\system32\mspaint.exe"
TaskID =3D Shell(objPaint, 1)
=20
sngCount =3D 2
sngStart =3D Timer
While sngEnd < sngStart + sngCount
sngEnd =3D Timer
Wend
AppActivate TaskID
Application.SendKeys "^{v}", True
sngCount =3D 2
sngStart =3D Timer
While sngEnd < sngStart + sngCount
sngEnd =3D Timer
Wend
AppActivate TaskID
Application.SendKeys "^{s}", True
sngCount =3D 2
sngStart =3D Timer
While sngEnd < sngStart + sngCount
sngEnd =3D Timer
Wend
Application.SendKeys FileSaveName, True
Application.SendKeys "%{s}", True
sngCount =3D 2
sngStart =3D Timer
While sngEnd < sngStart + sngCount
sngEnd =3D Timer
Wend
Application.SendKeys "%{F4}", True
End Sub


-----Original Message-----
From: Rob Coops [mailto:rcoops@gmail.com]=20
Sent: Monday, June 20, 2011 4:32 PM
To: andrewmchorney@cox.net
Cc: beginners@perl.org
Subject: Re: Convert spreadsheet to jpeg

On Mon, Jun 20, 2011 at 9:57 PM, wrote:

> Hello
>
> I am not an expert in perl and so before I propose that a particular =
script
> be written I would likek to get an idea as to how hard the task would =
be.
>
> We have a large number (in my opinion) of excel spreadsheets that need =
to
> be concerted to jpeg format. The jpeg files are used when a document =
is
> created and the jpeg files are inserted. The spreadsheets are under
> configuration control and the current policy is that when a =
spreadsheet is
> updated the jpeg file is created (via a macro) and it too goes under =
CM
> control. I am considering proposing that a perl script could go =
through the
> directory structure and save each spreadsheet to a jpeg file and it =
would be
> more efficient and cost effective.
>
> Question:
>
> 1. How hard is it to write a perl script that will open a spreadsheet =
and
> save it to a jpeg file?
> 2,. Does this capability exist now?
>
> Thanks,
> Andrew
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>
Hi Andrew,

Opening a spreadsheet with perl is certainly a simple enough thing to =
do,
converting to a JPEG is a different story as far as I know as this would
require your perl code to be able to draw the excel documents content. =
As
far as I am aware this is not possible but I might be wrong. Now you =
might
be tempted to think that you could just execute the macro but that again
would require perl to fully understand the way MS visual basic works and =
has
access to all functions and methods that this visual basic does.

I think to be honest that in this case it is probably easier to create a
simple macro to open a specific directory or even a directory provided
trough a popup box, then open each excel file run a fixed macro in =
there,
safe the file and close the excel, rinse, repeat and you should have the
same thing as your perl script is supposed to do. As you are by the =
sound of
it creating another MS based document or maybe a PDF file which can be
created out of a MS based document which is then printed to a PDF... =
again
this can relatively easily be done with an VBA macro.

I know not very perly of me but I am one that believes in using a spade =
to
dig a hole and drill to drill one ;-)

Regards,

Rob


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Convert spreadsheet to jpeg

am 21.06.2011 17:12:38 von Shawn Wilson

--485b3985b345593af204a63a4869
Content-Type: text/plain; charset=ISO-8859-1

On Jun 20, 2011 3:59 PM, wrote:
>
> Hello
>
> I am not an expert in perl and so before I propose that a particular
script be written I would likek to get an idea as to how hard the task would
be.
>
> We have a large number (in my opinion) of excel spreadsheets that need to
be concerted to jpeg format. The jpeg files are used when a document is
created and the jpeg files are inserted. The spreadsheets are under
configuration control and the current policy is that when a spreadsheet is
updated the jpeg file is created (via a macro) and it too goes under CM
control. I am considering proposing that a perl script could go through the
directory structure and save each spreadsheet to a jpeg file and it would be
more efficient and cost effective.
>
> Question:
>
> 1. How hard is it to write a perl script that will open a spreadsheet and
save it to a jpeg file?
> 2,. Does this capability exist now?
>

It depends on how much you want. Spreadsheet::ParseExcel has a basic example
of parsing a spreadsheet. Past that, there are modules to output text in a
grid - but I've never needed to create an image before so I don't know if
you'll need a grid or not.

Either way, this part seems pretty simple to me. However, if you want
formatting - colors, text / cell size, font, etc - I think you'll have to
work for that :)

--485b3985b345593af204a63a4869--

Re: Convert spreadsheet to jpeg

am 21.06.2011 21:16:51 von JPH

First print your Excel sheet to PDF, this shouldn't be too difficult as long as the Excel file is saved exactly the way you want it printed ...
Then convert the PDF files to JPG using ImageMagick.

On 06/20/2011 09:57 PM, andrewmchorney@cox.net wrote:
> Hello
>
> I am not an expert in perl and so before I propose that a particular script be written I would likek to get an idea as to how hard the task would be.
>
> We have a large number (in my opinion) of excel spreadsheets that need to be concerted to jpeg format. The jpeg files are used when a document is created and the jpeg files are inserted. The spreadsheets are under configuration control and the current policy is that when a spreadsheet is updated the jpeg file is created (via a macro) and it too goes under CM control. I am considering proposing that a perl script could go through the directory structure and save each spreadsheet to a jpeg file and it would be more efficient and cost effective.
>
> Question:
>
> 1. How hard is it to write a perl script that will open a spreadsheet and save it to a jpeg file?
> 2,. Does this capability exist now?
>
> Thanks,
> Andrew

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Convert spreadsheet to jpeg

am 22.06.2011 02:15:53 von jbiskofski

--bcaec554dc5a25c2e804a641df8e
Content-Type: text/plain; charset=ISO-8859-1

ive seen this be done with openoffice in command line mode, i dont know the
exact syntax but it should be easy to find out.

at that point all your perl script would need to do is loop the the file
list and do a system() call to the openoffice program that does the
conversion.

this is hows its done at bigbluebutton.org ( except they dont use perl )

On Mon, Jun 20, 2011 at 2:57 PM, wrote:

> Hello
>
> I am not an expert in perl and so before I propose that a particular script
> be written I would likek to get an idea as to how hard the task would be.
>
> We have a large number (in my opinion) of excel spreadsheets that need to
> be concerted to jpeg format. The jpeg files are used when a document is
> created and the jpeg files are inserted. The spreadsheets are under
> configuration control and the current policy is that when a spreadsheet is
> updated the jpeg file is created (via a macro) and it too goes under CM
> control. I am considering proposing that a perl script could go through the
> directory structure and save each spreadsheet to a jpeg file and it would be
> more efficient and cost effective.
>
> Question:
>
> 1. How hard is it to write a perl script that will open a spreadsheet and
> save it to a jpeg file?
> 2,. Does this capability exist now?
>
> Thanks,
> Andrew
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

--bcaec554dc5a25c2e804a641df8e--