/// <summary>
        /// Assign columns and column values to an array of columns for this table
        /// </summary>
        /// <param name="table">The table.</param>
        private void AssignColumns(Table table)
        {
            for (int columnIdx = 0; columnIdx < this.columnCount; columnIdx++)
            {
                TableColumn column       = table.TableData.Columns[columnIdx];
                bool        isLastColumn = columnIdx == (this.columnCount - 1);

                // Set ParentDataContext for value resolution
                column.ParentDataContext = table.TableData.DataContext;
                if (column.DataContext == null)
                {
                    column.DataContext = column.ParentDataContext;
                }

                this.columnInfos[columnIdx] = new TableColumnInfo
                {
                    Column         = column,
                    Width          = column.Width / this.columnWidthDivisor,
                    Hidden         = BindingContainer.ConvertToNullableBoolean(column.ColumnIsHidden).GetValueOrDefault(false),
                    ColumnSpan     = column.ColumnSpan,
                    IsLastColumn   = isLastColumn,
                    SpanLastColumn = isLastColumn && table.SpanLastColumn,
                };
            }
        }
Exemple #2
0
 /// <summary>
 /// Creates and populates the default TableData property from the ItemsSource and DataContext
 /// </summary>
 /// <param name="hostTableAlreadyPrepared">True if the host <see cref="Table"/> has already been prepared.</param>
 internal void CreateDefaultTableData(bool hostTableAlreadyPrepared)
 {
     this.tableData = new TableData
     {
         DataContext = BindingContainer.GetSourceBindingOrValue(this.DataContext),
         ItemsSource = BindingContainer.GetSourceBindingOrValue(this.ItemsSource),
         Columns     = this.Columns,
         Prepared    = hostTableAlreadyPrepared,
     };
 }
        /// <summary>
        /// Processes the supplied shape, setting properties on the shape as required.
        /// </summary>
        /// <param name="shape">The <see cref="Shape"/> which is to be represented in the worksheet</param>
        /// <param name="shapeModel">The <see cref="ShapeModel"/> which models the instance of the <see cref="DrawingSpreadsheet.Shape">OpenXML shape</see> in the Excel workbook</param>
        private static void ProcessDynamicShape(Shape shape, ShapeModel shapeModel)
        {
            if (shapeModel == null)
            {
                throw new ArgumentNullException("shapeModel");
            }

            System.Windows.Media.Color?fillColour = BindingContainer.ConvertToNullableColour(shape.FillColour);

            if (fillColour.HasValue)
            {
                UpdateShapeFillColour(shapeModel.Shape, fillColour.Value);
            }
        }