microsoft / pgtoolsservice

PostgreSQL Tools Service that provides PostgreSQL Server data management capabilities.
Other
83 stars 36 forks source link

Fix index out of range on Export to Excel when more than 26 columns #491

Open nachoalonsoportillo opened 6 months ago

nachoalonsoportillo commented 6 months ago

Fix defect reported via Export to excel more than 26 columns error "string index out of range Code: 0"

string.ascii_uppercase produces an array of 26 characters. Trying to reference anything beyond that, throws the error reported.

The write() method supports two forms of notation to designate the position of cells: row-column notations and A1 notation. My suggestion is that

self._worksheet.write(string.ascii_uppercase[index] + '1', column.column_name, bold)

is changed to:

self._worksheet.write(0, index, column.column_name, bold)