Re: [python-win32] save chart from an existing xlsx as an image

2014-06-20 Thread Vernon D. Cole
It might be possible to run some older versions of Excel on Linux using wine
https://winehq.org/ or crossover https://codeweavers.com/products/, but
I do not think that you will be able to control them using COM.  Python 2.7
(32 bit) for Windows and pywin32 can be installed using Wine, but many
features do not work. (I tried using Ubuntu 14.04).

It might be better to try opening your spreadsheet using libreoffice
http://www.libreoffice.org/, which has the ability to export .pdf files
(and works on both Linux and Windows).

Otherwise, you might only be able to make screen shots of your Excel window
using a Windows computer.



On Fri, Jun 20, 2014 at 8:23 AM, Weijie Wu -X (weijwu - YI JIN XIN XI FU
WU(SU ZHOU)YOU XIAN GONG SI at Cisco) wei...@cisco.com wrote:

  Hi, guys



 I know win32com is working on windows for python, and I’ve question:

 I want to save chart from demo.xlsx as an image.  I also found some code
 as below:



 *from win32com.client import Dispatch*

 *xlsApp = Dispatch(Excel.Application) *

 *xlsWB = xlsApp.Workbooks.Open(r'/tmp/test/demo.xlsx') *

 *xlsSheet = xlsWB.Sheets(sheet1) *

 *mychart = XlsSheet.Charts(1)  #'1' is the index of the chart object in
 the wb*

 *mychart.Export(Filename=r'/tmp/test/MyExportedChart.png')*





 is there anyway I can run this code on linux ?



 or is there anyway I can save chart from an existing xlsx as an image?



 It drives me crazy.





 Thanks

 Wiley





 ___
 python-win32 mailing list
 python-win32@python.org
 https://mail.python.org/mailman/listinfo/python-win32


___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] save chart from an existing xlsx as an image

2014-06-20 Thread Christian Calderon
Are you trying to extract data from the file to make a graph? This is
possible.
On Jun 20, 2014 1:09 AM, Weijie Wu -X (weijwu - YI JIN XIN XI FU WU(SU
ZHOU)YOU XIAN GONG SI at Cisco) wei...@cisco.com wrote:

  Hi, guys



 I know win32com is working on windows for python, and I’ve question:

 I want to save chart from demo.xlsx as an image.  I also found some code
 as below:



 *from win32com.client import Dispatch*

 *xlsApp = Dispatch(Excel.Application) *

 *xlsWB = xlsApp.Workbooks.Open(r'/tmp/test/demo.xlsx') *

 *xlsSheet = xlsWB.Sheets(sheet1) *

 *mychart = XlsSheet.Charts(1)  #'1' is the index of the chart object in
 the wb*

 *mychart.Export(Filename=r'/tmp/test/MyExportedChart.png')*





 is there anyway I can run this code on linux ?



 or is there anyway I can save chart from an existing xlsx as an image?



 It drives me crazy.





 Thanks

 Wiley





 ___
 python-win32 mailing list
 python-win32@python.org
 https://mail.python.org/mailman/listinfo/python-win32


___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] save chart from an existing xlsx as an image

2014-06-20 Thread Tim Roberts
quote
I know win32com is working on windows for python, and I’ve question:
I want to save chart from demo.xlsx as an image.  I also found some code as 
below:
/quote

Allow me to summarize the other responses.
1. Excel does not run on Linux.
2. It can be made to run in a Windows emulator, but you can't get COM access.
3. It is possible to read data from Excel files without using Excel.
4. There are many excellent plotting packages for Python that do not involve 
Excel.
--
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32