Modify

Opened 7 years ago

Last modified 5 years ago

#1596 new defect

New features

Reported by: jabol20@… Owned by: cmlenz
Priority: normal Component: ExcelViewerPlugin
Severity: minor Keywords:
Cc: rjollos 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 7 years ago.

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by anonymous

comment:1 Changed 5 years ago by rjollos

  • Cc rjollos added; anonymous removed

comment:2 follow-up: Changed 5 years ago by Myriam

  • Trac Release changed from 0.10 to 0.11
  • Type changed from enhancement to defect

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 5 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 5 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):

Add Comment

Modify Ticket

Action
as new The owner will remain cmlenz.
Author


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

 
Note: See TracTickets for help on using tickets.