Modify

Opened 10 years ago

Last modified 8 years ago

#1596 new defect

New features

Reported by: jabol20@… Owned by: Christopher Lenz
Priority: normal Component: ExcelViewerPlugin
Severity: minor Keywords:
Cc: Ryan J Ollos Trac Release: 0.11

Description

Hello

I modified Your plugin a bit and maybe You would like to include these changes.

Added few features:

  • coloring of text and background (but it skips row/column format - only cell color or default)
  • merging cells
  • support for text weight and italic
  • row identifiers - allows to create links in form attachment/wiki/Page/file.xls#row7

To extract these info it's necessary to have newest xlrd - 0.6.1. I'm not python programmer, so my code is crappy, but it works :-) Modified file is in attachment.

Attachments (1)

__init__.py (3.6 KB) - added by anonymous 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by anonymous

Attachment: __init__.py added

comment:1 Changed 8 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:2 Changed 8 years ago by Myriam

Trac Release: 0.100.11
Type: enhancementdefect

The replacement of __init__.py of zipped source by the attached file does not allow to have coloring text with trac 0.11.5.

comment:3 in reply to:  2 Changed 8 years ago by austin

Replying to Myriam:

The replacement of __init__.py of zipped source by the attached file does not allow to have coloring text with trac 0.11.5.

Make sure to clear out your browser's cache. It probably still has the output of the previously viewed spreadsheet.I ran into the same issue and clearing the cache does refresh the color.

comment:4 Changed 8 years ago by austin

The color works great! Many thanks for sharing.

I found out that the plugin was skipping merged columns and empty rows including colored cells. I have made some changes to fix that. Here's the code fragment (see FIXME):

for crange in sheet.merged_cells:
    rlo, rhi, clo, chi = crange
    merged[(rlo,clo)]=(rhi-rlo,chi-clo) #colspan,rowspan
    for rx in xrange(rlo, rhi):
        for cx in xrange(clo, chi):
            skipped[(rx,cx)] = True
        skipped[(rx,0)] = False         #FIXME: don'st skip column span
    skipped[(rlo,clo)] = False

Don't filter out rows with no cell value. It may have color.

for ridx in range(sheet.nrows):
    row = sheet.row(ridx)
    #FIXME: if not filter(lambda cell: unicode(cell.value), row):
    #FIXME:    continue
    buf.append(u'<tr class="%s" id="row%d">' % (ridx % 2 and 'odd' or 'even', ridx + 1))
    for cidx, cell in enumerate(row):

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Christopher Lenz.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.