Hi, Today I found out that named ranges do not grow horizontally when using smart markers.
Consider the following example.
Note: functions NextRight (etc) are extension methods I implemented, feel free to adopt.
Cell upperLeftCorner = columnsCellName; Cell lowerRightCorner = columnsCellValue;foreach (DataColumn column in table.Columns) { // give the cell the name of the column sheet.Cells.CreateRange(columnsCellValue.Name).Name = column.ColumnName; columnsCellName.Value = column.ColumnName; lowerRightCorner = columnsCellValue; //Place the marker and move to the next cells if (orientation == KindOfOrientation.Horizontal) { // Normal table layout, columnnames at the top. columnsCellValue.Value = "&=" + tablename + "." + column.ColumnName; columnsCellName = columnsCellName.NextRight(); columnsCellValue = columnsCellValue.NextRight(); } else { //Rotated table layout, columnnames at the left, each row is a column columnsCellValue.Value = "&=" + tablename + "." + column.ColumnName + "(horizontal)"; columnsCellName = columnsCellName.NextDown(); columnsCellValue = columnsCellValue.NextDown(); } }//Create range for the entire table
sheet.Cells.CreateRange(upperLeftCorner.Name, lowerRightCorner.Name).Name = tablename;
Now when I use the Designer to process the table in Horizontal orientation, the range
will automatically grow with each row in the table (all rows are inside range).
When I use the vertical; orientation, the range remains untouched.
Which means that only the first row (diplayed in the first column) will be included in the range.
This is not consistent behaviour.
Please let me know if this is a bug, know isssue or a shortcomming in my understanding of the software.
Kind regards,
Bas