0

I'm trying to hide grid on successfully generated .xls with 2 sheets included. I read the xlwt doc and among other properties that can be set on xlwt-related objects, there is show_grid function included. I was trying following, but it doesn't change anything:

with open(os.path.join('sheet1_test.csv'), 'rb') as cf:
    reader = csv.reader(cf)
        for r, row in enumerate(reader):
            for c, col in enumerate(row):
                sheet1.write(c, r, col, easyxf(
                'font: name Arial;',
                'show_grid: off'
                ))

I appreciate any help.

Mali Makh
  • 33
  • 6

1 Answers1

3

Tweaking the first example here:

import xlwt
workbook = xlwt.Workbook(encoding = 'ascii')
worksheet = workbook.add_sheet('My Worksheet')
worksheet.show_grid = False # "show_grid" is a property of the worksheet!
worksheet.write(0, 0, label = 'Row 0, Column 0 Value')
workbook.save('Excel_Workbook.xls')

You can see that show_grid is a property of the worksheet, not a cell option for easyxf. (show_grid turns off the grid in the worksheet)

Gerrat
  • 28,863
  • 9
  • 73
  • 101
  • It makes sense, thanks for your answer, I'll take a look, even though the problem had been already solved – Mali Makh Dec 05 '12 at 01:39