dfujim / SpreadsheetPlagiarism

Compare Microsoft Excel Spreadsheets to look for plagiarism
https://pypi.org/project/compsheet/
MIT License
0 stars 1 forks source link

Columns hidden #3

Closed dfujim closed 5 years ago

dfujim commented 6 years ago

Joss finds columns A-H hidden in the spreadsheet.

dfujim commented 6 years ago

Commit ba526ccfc4ced312a1aa579e6c78b12fd78bd40b explicitly sets columns to visible.

dfujim commented 5 years ago

This is apparently an issue with how windows stores column widths.

"The problem is that for some reason Excel stores column widths in relation to the number of characters whereas everything else is either points or pixels which are convertible"

See this issue report.

dfujim commented 5 years ago

It's possible for columns to be set to a width of zero.

Column widths print as "None" (should set to default width).

In multifile_comparer.py, in print_spreadsheet:

# adjust column sizes, prevent hiding
for i,_ in enumerate(sht.columns): 
    sht.column_dimensions[get_column_letter(i+1)].auto_size = True
    sht.column_dimensions[get_column_letter(i+1)].hidden = False
    print(sht.column_dimensions[get_column_letter(i+1)].width) # this line prints None
    print(sht.column_dimensions[get_column_letter(i+1)].hidden) # this line prints False
dfujim commented 5 years ago

Joss: I just checked and did an autosize width and it is that the widths are zero. You could set them to a specific size (standard size seems to be 96 pixels).


Derek: Fixing the widths is annoying to view in LibreOffice, Ubuntu 18.04.1:

screenshot from 2018-11-29 14-36-27

dfujim commented 5 years ago

Note the column widths are set in number of characters. The following appears to set reasonable output.

# adjust column sizes, prevent hiding
for i,_ in enumerate(sht.columns): 
    sht.column_dimensions[get_column_letter(i+1)].auto_size = False
    sht.column_dimensions[get_column_letter(i+1)].hidden = False
sht.sheet_format.defaultColWidth = 15
dfujim commented 5 years ago

Resolved in commit 8571cf8