open(.xls file, 'w') so that hyperlinks appear

Lemniscate d_blade8 at
Fri Nov 16 04:00:22 CET 2001

Messy, yeah, though it is getting cleaned up as I go, lol.  Actually,
you and I seem to be on the same wavelength.  If you look at my code,
you'll notice that  I extened EasyExcel with a SetComment method
already.  As soon as I figured out what to do to get the hyperlinks
inserted, I did the same thing (I now have a SetHyperlink method in
Easy Excel).  Additionally, you mention that I don't have a sheets
parameter in my method calls.  That was done on purpose to make the
code a bit easier to read.  I modified the methods to have sheets with
a default value of 1.  I don't intend on using more than one worksheet
at a time, but I left the door open so I could pass different values
if I wanted to.  I am in the process of moving things over into
functions but I am, by no means, there yet.  That was one of the
reasons I was reluctant to post my present code.  Anyways, thanks a

Jeff Shannon <jeff at> wrote in message news:<3BF1B946.35E697B1 at>...
> Lemniscate wrote:
> > Actually, here is the code I am working on now.  .....
> Whew.  I'm not very familiar with Tkinter, and as you warned, the code
> *is* messy   :)   You might find things easier if you separated this into
> several functions/classes--one to set up the GUI, one to parse your input
> files, one to drive Excel, etc.  That would make it a bit easier to keep
> track of what's going on here.  However, as for the hyperlink problem...
> >
> >             Pstr = GenericLinkGen.FindTheURL(HLLstr,
> > r"")
> >             #Pout.write(Pstr)
> >             XL.SetCell(xRow,xCol, Pstr)
> I *think* that this is the part that you're trying to create as a
> hyperlink.  Presuming that Pstr contains the URL that you want to link to,
> and that xRow and xCol are the row/column of the cell you want the
> hyperlink to appear in...
> Try extending the easyExcel class (from the Python on Win32 book) like
> this (I haven't tested it, I'm just going from the docs):
> class ExtendedExcel(easyExcel):
>     def setHyperlink(self, sheet, row, col, url):
>         sht = self.xlBook.Worksheets(sheet)
>         sht.Hyperlinks.Add(sht.Cells(row, col),url)
> Then, in the above code fragment, replace the setcell call with:
>         XL.setHyperlink(1, xRow, xCol, Pstr)
> (I notice that your XL method calls don't include the sheet parameter,
> unlike the book's version, so you may wish to modify this to treat the
> sheet in the same way that you do for setCell(), etc...)
> Jeff Shannon
> Technician/Programmer
> Credit International

More information about the Python-list mailing list