Is there a simple way to get the whole cell width of a cell merging over other cells (Using e.g. MergeRight = 3)?
The problem, I'm currently facing with my algorithm from my previous question
viewtopic.php?f=2&t=3923, is that if a cell uses the MergeRight property with a value bigger than 0 (Or to put it in other words, with the MergeRight property at all), I get only the width of the first column of the table (The green frame in the attached image) while I wanted to get the width of the whole row (The red frame in the attached image). Is there a simple way to achieve this?
Attachment:
SpannedCellWidthExample.png [ 29.38 KiB | Viewed 5570 times ]
Just as an idea: I would start from the current cell, get all cells that are within the range of MergeRight (So, if MergeRight = 3), I would get the next 3 cells and sum up the width of all of them:
Something like that:
Code:
var totalWidth = cell.Column.Width;
foreach (var column in cell.Table.Columns)
{
var realColumn = column as Column;
if (realColumn.Index <= cell.Column.Index)
{
continue;
}
totalWidth += realColumn.Width;
}