Page 1 of 1

AutoWidthCol ignoring merged cells

Posted: Wed Jan 28, 2015 7:25 pm
by mwhiting
Lars, The TXLSWorksheet.AutoWidthCol appears to ignore all cells within a merged cell area when looking for the largest cell pixel length in the column. I'm guessing this is a bug as Excel does not ignore merged cells when auto setting the width. I can understand skipping if the merge areas has multiple columns, but not when the area is merging rows within the same column. (AutoHeightRow doesn't check for merged areas at all.) Could you look into this?

Thanks!

Code: Select all

XLS[0].AutoWidthCols(0,XLS[fSheetCount-1].LastCol);

Re: AutoWidthCol ignoring merged cells

Posted: Wed Jan 28, 2015 9:17 pm
by larsa
Hello

This is a known limitation. Will be fixed in a later update.

Re: AutoWidthCol ignoring merged cells

Posted: Wed Jan 28, 2015 10:06 pm
by mwhiting
Here's a workaround for anyone that is having the same problem:
Change the following in the TXLSWorksheet.AutoWidthCol function of the XLSSheetData5 unit

Code: Select all

Original
      if FCells.FindCell(ACol,FCells.IterCellRow,C) and (FMergedCells.CellInAreas(ACol,FCells.IterCellRow) <= -1)  then begin
Workaround
      if FCells.FindCell(ACol,FCells.IterCellRow,C){ and (FMergedCells.CellInAreas(ACol,FCells.IterCellRow) <= -1) }then begin