Beispiel #1
0
        internal void FromPivotFilter(PivotFilter pf)
        {
            SetAllNull();

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

            if (pf.AutoFilter != null)
            {
                AutoFilter.FromAutoFilter(pf.AutoFilter);
            }
        }
        internal void FromTable(Table t)
        {
            SetAllNull();

            if (t.AutoFilter != null)
            {
                AutoFilter.FromAutoFilter(t.AutoFilter);
                HasAutoFilter = true;
            }
            if (t.SortState != null)
            {
                SortState.FromSortState(t.SortState);
                HasSortState = true;
            }
            using (var oxr = OpenXmlReader.Create(t.TableColumns))
            {
                SLTableColumn tc;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(TableColumn))
                    {
                        tc = new SLTableColumn();
                        tc.FromTableColumn((TableColumn)oxr.LoadCurrentElement());
                        TableColumns.Add(tc);
                    }
                }
            }
            if (t.TableStyleInfo != null)
            {
                TableStyleInfo.FromTableStyleInfo(t.TableStyleInfo);
                HasTableStyleInfo = true;
            }

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

            var iStartRowIndex    = 1;
            var iStartColumnIndex = 1;
            var iEndRowIndex      = 1;
            var iEndColumnIndex   = 1;
            var sRef = t.Reference.Value;

            if (sRef.IndexOf(":") > 0)
            {
                if (SLTool.FormatCellReferenceRangeToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex,
                                                                    out iEndRowIndex, out iEndColumnIndex))
                {
                    StartRowIndex    = iStartRowIndex;
                    StartColumnIndex = iStartColumnIndex;
                    EndRowIndex      = iEndRowIndex;
                    EndColumnIndex   = iEndColumnIndex;
                }
            }
            else
            {
                if (SLTool.FormatCellReferenceToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex))
                {
                    StartRowIndex    = iStartRowIndex;
                    StartColumnIndex = iStartColumnIndex;
                    EndRowIndex      = iStartRowIndex;
                    EndColumnIndex   = iStartColumnIndex;
                }
            }

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