internal SLConditionalFormatting2010 Clone()
        {
            SLConditionalFormatting2010 cf = new SLConditionalFormatting2010();

            int i;

            cf.Rules = new List <SLConditionalFormattingRule2010>();
            for (i = 0; i < this.Rules.Count; ++i)
            {
                cf.Rules.Add(this.Rules[i].Clone());
            }

            cf.ReferenceSequence = new List <SLCellPointRange>();
            SLCellPointRange cpr;

            for (i = 0; i < this.ReferenceSequence.Count; ++i)
            {
                cpr = new SLCellPointRange(this.ReferenceSequence[i].StartRowIndex, this.ReferenceSequence[i].StartColumnIndex, this.ReferenceSequence[i].EndRowIndex, this.ReferenceSequence[i].EndColumnIndex);
                cf.ReferenceSequence.Add(cpr);
            }

            cf.Pivot = this.Pivot;

            return(cf);
        }
        internal SLConditionalFormatting2010 Clone()
        {
            SLConditionalFormatting2010 cf = new SLConditionalFormatting2010();

            int i;
            cf.Rules = new List<SLConditionalFormattingRule2010>();
            for (i = 0; i < this.Rules.Count; ++i)
            {
                cf.Rules.Add(this.Rules[i].Clone());
            }

            cf.ReferenceSequence = new List<SLCellPointRange>();
            SLCellPointRange cpr;
            for (i = 0; i < this.ReferenceSequence.Count; ++i)
            {
                cpr = new SLCellPointRange(this.ReferenceSequence[i].StartRowIndex, this.ReferenceSequence[i].StartColumnIndex, this.ReferenceSequence[i].EndRowIndex, this.ReferenceSequence[i].EndColumnIndex);
                cf.ReferenceSequence.Add(cpr);
            }

            cf.Pivot = this.Pivot;

            return cf;
        }
Exemplo n.º 3
0
        private void SetAllNull()
        {
            this.IsNewPivotTable = true;
            this.DataRange = new SLCellPointRange(-1, -1, -1, -1);
            this.IsDataSourceTable = false;
            this.SheetTableName = string.Empty;

            // Excel 2013 uses 5 for attributes createdVersion and updatedVersion
            // and 3 for attribute minRefreshableVersion.
            // I don't know what earlier versions of Excel use because I've uninstalled
            // the earlier versions of Excel 2007 and 2010...
            // These three attributes are application dependent, which means technically they're
            // dependent on SpreadsheetLight.
            // For the sake of simplicity, I'm going to set all three attributes to the value of 3,
            // so Excel (whatever version) can handle it without being insufferable.

            this.Name = "";
            this.CacheId = 0;
            this.DataOnRows = false;
            this.DataPosition = null;

            this.AutoFormatId = null;
            this.ApplyNumberFormats = null;
            this.ApplyBorderFormats = null;
            this.ApplyFontFormats = null;
            this.ApplyPatternFormats = null;
            this.ApplyAlignmentFormats = null;
            this.ApplyWidthHeightFormats = null;

            this.DataCaption = "";
            this.GrandTotalCaption = "";
            this.ErrorCaption = "";
            this.ShowError = false;
            this.MissingCaption = "";
            this.ShowMissing = true;
            this.PageStyle = "";
            this.PivotTableStyleName = "";
            this.VacatedStyle = "";
            this.Tag = "";
            this.UpdatedVersion = 3; // supposed to default 0. See above.
            this.MinRefreshableVersion = 3; // supposed to default 0. See above.
            this.AsteriskTotals = false;
            this.ShowItems = true;
            this.EditData = false;
            this.DisableFieldList = false;
            this.ShowCalculatedMembers = true;
            this.VisualTotals = true;
            this.ShowMultipleLabel = true;
            this.ShowDataDropDown = true;
            this.ShowDrill = true;
            this.PrintDrill = false;
            this.ShowMemberPropertyTips = true;
            this.ShowDataTips = true;
            this.EnableWizard = true;
            this.EnableDrill = true;
            this.EnableFieldProperties = true;
            this.PreserveFormatting = true;
            this.UseAutoFormatting = false;
            this.PageWrap = 0;
            this.PageOverThenDown = false;
            this.SubtotalHiddenItems = false;
            this.RowGrandTotals = true;
            this.ColumnGrandTotals = true;
            this.FieldPrintTitles = false;
            this.ItemPrintTitles = false;
            this.MergeItem = false;
            this.ShowDropZones = true;
            this.CreatedVersion = 3; // supposed to default 0. See above.
            this.Indent = 1;
            this.ShowEmptyRow = false;
            this.ShowEmptyColumn = false;
            this.ShowHeaders = true;
            this.Compact = true;
            this.Outline = false;
            this.OutlineData = false;
            this.CompactData = true;
            this.Published = false;
            this.GridDropZones = false;
            this.StopImmersiveUi = true;
            this.MultipleFieldFilters = true;
            this.ChartFormat = 0;
            this.RowHeaderCaption = "";
            this.ColumnHeaderCaption = "";
            this.FieldListSortAscending = false;
            this.CustomListSort = true;
        }
        internal void FromConditionalFormatting(ConditionalFormatting cf)
        {
            this.SetAllNull();

            if (cf.Pivot != null) this.Pivot = cf.Pivot.Value;

            SLCellPointRange pt;
            int index;
            int iStartRowIndex = -1;
            int iStartColumnIndex = -1;
            int iEndRowIndex = -1;
            int iEndColumnIndex = -1;
            foreach (var s in cf.SequenceOfReferences.Items)
            {
                index = s.Value.IndexOf(":");
                if (index > -1)
                {
                    if (SLTool.FormatCellReferenceRangeToRowColumnIndex(s.Value, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex))
                    {
                        pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex);
                        this.SequenceOfReferences.Add(pt);
                    }
                }
                else
                {
                    if (SLTool.FormatCellReferenceToRowColumnIndex(s.Value, out iStartRowIndex, out iStartColumnIndex))
                    {
                        pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iStartRowIndex, iStartColumnIndex);
                        this.SequenceOfReferences.Add(pt);
                    }
                }
            }

            foreach (var rule in cf.Elements<ConditionalFormattingRule>())
            {
                var cfr = new SLConditionalFormattingRule();
                cfr.FromConditionalFormattingRule(rule);
                this.Rules.Add(cfr);
            }
        }
Exemplo n.º 5
0
        private void SetAllNull()
        {
            this.IsNewPivotTable   = true;
            this.DataRange         = new SLCellPointRange(-1, -1, -1, -1);
            this.IsDataSourceTable = false;
            this.SheetTableName    = string.Empty;

            // Excel 2013 uses 5 for attributes createdVersion and updatedVersion
            // and 3 for attribute minRefreshableVersion.
            // I don't know what earlier versions of Excel use because I've uninstalled
            // the earlier versions of Excel 2007 and 2010...
            // These three attributes are application dependent, which means technically they're
            // dependent on SpreadsheetLight.
            // For the sake of simplicity, I'm going to set all three attributes to the value of 3,
            // so Excel (whatever version) can handle it without being insufferable.

            this.Name         = "";
            this.CacheId      = 0;
            this.DataOnRows   = false;
            this.DataPosition = null;

            this.AutoFormatId            = null;
            this.ApplyNumberFormats      = null;
            this.ApplyBorderFormats      = null;
            this.ApplyFontFormats        = null;
            this.ApplyPatternFormats     = null;
            this.ApplyAlignmentFormats   = null;
            this.ApplyWidthHeightFormats = null;

            this.DataCaption         = "";
            this.GrandTotalCaption   = "";
            this.ErrorCaption        = "";
            this.ShowError           = false;
            this.MissingCaption      = "";
            this.ShowMissing         = true;
            this.PageStyle           = "";
            this.PivotTableStyleName = "";
            this.VacatedStyle        = "";
            this.Tag                    = "";
            this.UpdatedVersion         = 3; // supposed to default 0. See above.
            this.MinRefreshableVersion  = 3; // supposed to default 0. See above.
            this.AsteriskTotals         = false;
            this.ShowItems              = true;
            this.EditData               = false;
            this.DisableFieldList       = false;
            this.ShowCalculatedMembers  = true;
            this.VisualTotals           = true;
            this.ShowMultipleLabel      = true;
            this.ShowDataDropDown       = true;
            this.ShowDrill              = true;
            this.PrintDrill             = false;
            this.ShowMemberPropertyTips = true;
            this.ShowDataTips           = true;
            this.EnableWizard           = true;
            this.EnableDrill            = true;
            this.EnableFieldProperties  = true;
            this.PreserveFormatting     = true;
            this.UseAutoFormatting      = false;
            this.PageWrap               = 0;
            this.PageOverThenDown       = false;
            this.SubtotalHiddenItems    = false;
            this.RowGrandTotals         = true;
            this.ColumnGrandTotals      = true;
            this.FieldPrintTitles       = false;
            this.ItemPrintTitles        = false;
            this.MergeItem              = false;
            this.ShowDropZones          = true;
            this.CreatedVersion         = 3; // supposed to default 0. See above.
            this.Indent                 = 1;
            this.ShowEmptyRow           = false;
            this.ShowEmptyColumn        = false;
            this.ShowHeaders            = true;
            this.Compact                = true;
            this.Outline                = false;
            this.OutlineData            = false;
            this.CompactData            = true;
            this.Published              = false;
            this.GridDropZones          = false;
            this.StopImmersiveUi        = true;
            this.MultipleFieldFilters   = true;
            this.ChartFormat            = 0;
            this.RowHeaderCaption       = "";
            this.ColumnHeaderCaption    = "";
            this.FieldListSortAscending = false;
            this.CustomListSort         = true;
        }
Exemplo n.º 6
0
        internal static string TranslateCellPointRangeToReference(SLCellPointRange Range)
        {
            string result = string.Empty;
            if (Range.StartRowIndex == Range.EndRowIndex && Range.StartColumnIndex == Range.EndColumnIndex)
            {
                result = SLTool.ToCellReference(Range.StartRowIndex, Range.StartColumnIndex);
            }
            else
            {
                result = SLTool.ToCellRange(Range.StartRowIndex, Range.StartColumnIndex, Range.EndRowIndex, Range.EndColumnIndex);
            }

            return result;
        }
Exemplo n.º 7
0
        internal static List<SLCellPointRange> TranslateSeqRefToCellPointRange(ListValue<StringValue> SeqRef)
        {
            List<SLCellPointRange> pts = new List<SLCellPointRange>();

            SLCellPointRange pt;
            int index;
            int iStartRowIndex = -1;
            int iStartColumnIndex = -1;
            int iEndRowIndex = -1;
            int iEndColumnIndex = -1;

            foreach (StringValue s in SeqRef.Items)
            {
                index = s.Value.IndexOf(":");
                if (index > -1)
                {
                    if (SLTool.FormatCellReferenceRangeToRowColumnIndex(s.Value, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex))
                    {
                        pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex);
                        pts.Add(pt);
                    }
                }
                else
                {
                    if (SLTool.FormatCellReferenceToRowColumnIndex(s.Value, out iStartRowIndex, out iStartColumnIndex))
                    {
                        pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iStartRowIndex, iStartColumnIndex);
                        pts.Add(pt);
                    }
                }
            }

            return pts;
        }
Exemplo n.º 8
0
        internal static List<SLCellPointRange> TranslateRefSeqToCellPointRange(Excel.ReferenceSequence RefSeq)
        {
            List<SLCellPointRange> pts = new List<SLCellPointRange>();

            SLCellPointRange pt;
            int index;
            int iStartRowIndex = -1;
            int iStartColumnIndex = -1;
            int iEndRowIndex = -1;
            int iEndColumnIndex = -1;

            string[] saRef = RefSeq.Text.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            foreach (string s in saRef)
            {
                index = s.IndexOf(":");
                if (index > -1)
                {
                    if (SLTool.FormatCellReferenceRangeToRowColumnIndex(s, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex))
                    {
                        pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex);
                        pts.Add(pt);
                    }
                }
                else
                {
                    if (SLTool.FormatCellReferenceToRowColumnIndex(s, out iStartRowIndex, out iStartColumnIndex))
                    {
                        pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iStartRowIndex, iStartColumnIndex);
                        pts.Add(pt);
                    }
                }
            }

            return pts;
        }
Exemplo n.º 9
0
        internal static SLCellPointRange TranslateReferenceToCellPointRange(string Reference)
        {
            SLCellPointRange pt = new SLCellPointRange();
            int index;
            int iStartRowIndex = -1;
            int iStartColumnIndex = -1;
            int iEndRowIndex = -1;
            int iEndColumnIndex = -1;

            index = Reference.IndexOf(":");
            if (index > -1)
            {
                if (SLTool.FormatCellReferenceRangeToRowColumnIndex(Reference, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex))
                {
                    pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex);
                }
            }
            else
            {
                if (SLTool.FormatCellReferenceToRowColumnIndex(Reference, out iStartRowIndex, out iStartColumnIndex))
                {
                    pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iStartRowIndex, iStartColumnIndex);
                }
            }

            return pt;
        }