Example #1
0
        internal PivotFilter ToPivotFilter()
        {
            var pf = new PivotFilter();

            pf.Field = Field;
            if (MemberPropertyFieldId != null)
            {
                pf.MemberPropertyFieldId = MemberPropertyFieldId.Value;
            }
            pf.Type = Type;
            if (EvaluationOrder != 0)
            {
                pf.EvaluationOrder = EvaluationOrder;
            }
            pf.Id = Id;
            if (MeasureHierarchy != null)
            {
                pf.MeasureHierarchy = MeasureHierarchy.Value;
            }
            if (MeasureField != null)
            {
                pf.MeasureField = MeasureField.Value;
            }
            if ((Name != null) && (Name.Length > 0))
            {
                pf.Name = Name;
            }
            if ((Description != null) && (Description.Length > 0))
            {
                pf.Description = Description;
            }
            if ((StringValue1 != null) && (StringValue1.Length > 0))
            {
                pf.StringValue1 = StringValue1;
            }
            if ((StringValue2 != null) && (StringValue2.Length > 0))
            {
                pf.StringValue2 = StringValue2;
            }

            pf.AutoFilter = AutoFilter.ToAutoFilter();

            return(pf);
        }
        internal Table ToTable()
        {
            var t = new Table();

            if (HasAutoFilter)
            {
                t.AutoFilter = AutoFilter.ToAutoFilter();
            }
            if (HasSortState)
            {
                t.SortState = SortState.ToSortState();
            }

            t.TableColumns = new TableColumns {
                Count = (uint)TableColumns.Count
            };
            for (var i = 0; i < TableColumns.Count; ++i)
            {
                t.TableColumns.Append(TableColumns[i].ToTableColumn());
            }

            if (HasTableStyleInfo)
            {
                t.TableStyleInfo = TableStyleInfo.ToTableStyleInfo();
            }

            t.Id = Id;
            if (Name != null)
            {
                t.Name = Name;
            }
            t.DisplayName = DisplayName;
            if (Comment != null)
            {
                t.Comment = Comment;
            }

            if ((StartRowIndex == EndRowIndex) && (StartColumnIndex == EndColumnIndex))
            {
                t.Reference = SLTool.ToCellReference(StartRowIndex, StartColumnIndex);
            }
            else
            {
                t.Reference = string.Format("{0}:{1}",
                                            SLTool.ToCellReference(StartRowIndex, StartColumnIndex),
                                            SLTool.ToCellReference(EndRowIndex, EndColumnIndex));
            }

            if (HasTableType)
            {
                t.TableType = TableType;
            }
            if (HeaderRowCount != 1)
            {
                t.HeaderRowCount = HeaderRowCount;
            }
            if ((InsertRow != null) && InsertRow.Value)
            {
                t.InsertRow = InsertRow.Value;
            }
            if ((InsertRowShift != null) && InsertRowShift.Value)
            {
                t.InsertRowShift = InsertRowShift.Value;
            }
            if (TotalsRowCount != 0)
            {
                t.TotalsRowCount = TotalsRowCount;
            }
            if ((TotalsRowShown != null) && !TotalsRowShown.Value)
            {
                t.TotalsRowShown = TotalsRowShown.Value;
            }
            if ((Published != null) && Published.Value)
            {
                t.Published = Published.Value;
            }
            if (HeaderRowFormatId != null)
            {
                t.HeaderRowFormatId = HeaderRowFormatId.Value;
            }
            if (DataFormatId != null)
            {
                t.DataFormatId = DataFormatId.Value;
            }
            if (TotalsRowFormatId != null)
            {
                t.TotalsRowFormatId = TotalsRowFormatId.Value;
            }
            if (HeaderRowBorderFormatId != null)
            {
                t.HeaderRowBorderFormatId = HeaderRowBorderFormatId.Value;
            }
            if (BorderFormatId != null)
            {
                t.BorderFormatId = BorderFormatId.Value;
            }
            if (TotalsRowBorderFormatId != null)
            {
                t.TotalsRowBorderFormatId = TotalsRowBorderFormatId.Value;
            }
            if (HeaderRowCellStyle != null)
            {
                t.HeaderRowCellStyle = HeaderRowCellStyle;
            }
            if (DataCellStyle != null)
            {
                t.DataCellStyle = DataCellStyle;
            }
            if (TotalsRowCellStyle != null)
            {
                t.TotalsRowCellStyle = TotalsRowCellStyle;
            }
            if (ConnectionId != null)
            {
                t.ConnectionId = ConnectionId.Value;
            }

            return(t);
        }