Ejemplo n.º 1
0
 public IXLHeaderFooter Clear(XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     Left.Clear(occurrence);
     Right.Clear(occurrence);
     Center.Clear(occurrence);
     return this;
 }
Ejemplo n.º 2
0
 public IXLHeaderFooter Clear(XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     Left.Clear(occurrence);
     Right.Clear(occurrence);
     Center.Clear(occurrence);
     return(this);
 }
Ejemplo n.º 3
0
        internal String SetInnerText(XLHFOccurrence occurrence, String text)
        {
            var parsedElements = ParseFormattedHeaderFooterText(text);

            if (parsedElements.Any(e => e.Position == 'L'))
            {
                this.Left.AddText(string.Join("\r\n", parsedElements.Where(e => e.Position == 'L').Select(e => e.Text).ToArray()), occurrence);
            }

            if (parsedElements.Any(e => e.Position == 'C'))
            {
                this.Center.AddText(string.Join("\r\n", parsedElements.Where(e => e.Position == 'C').Select(e => e.Text).ToArray()), occurrence);
            }

            if (parsedElements.Any(e => e.Position == 'R'))
            {
                this.Right.AddText(string.Join("\r\n", parsedElements.Where(e => e.Position == 'R').Select(e => e.Text).ToArray()), occurrence);
            }


            if (innerTexts.ContainsKey(occurrence))
            {
                innerTexts[occurrence] = text;
            }
            else
            {
                innerTexts.Add(occurrence, text);
            }

            return(innerTexts[occurrence]);
        }
Ejemplo n.º 4
0
 private void AddTextToOccurrence(XLHFText hfText, XLHFOccurrence occurrence)
 {
     if (texts.ContainsKey(occurrence))
         texts[occurrence].Add(hfText);
     else
         texts.Add(occurrence, new List<XLHFText> { hfText });
 }
Ejemplo n.º 5
0
 private void ClearOccurrence(XLHFOccurrence occurrence)
 {
     if (texts.ContainsKey(occurrence))
     {
         texts.Remove(occurrence);
     }
 }
Ejemplo n.º 6
0
        public IXLRichString AddText(XLHFPredefinedText predefinedText, XLHFOccurrence occurrence)
        {
            String hfText;

            switch (predefinedText)
            {
            case XLHFPredefinedText.PageNumber: hfText = "&P"; break;

            case XLHFPredefinedText.NumberOfPages: hfText = "&N"; break;

            case XLHFPredefinedText.Date: hfText = "&D"; break;

            case XLHFPredefinedText.Time: hfText = "&T"; break;

            case XLHFPredefinedText.Path: hfText = "&Z"; break;

            case XLHFPredefinedText.File: hfText = "&F"; break;

            case XLHFPredefinedText.SheetName: hfText = "&A"; break;

            case XLHFPredefinedText.FullPath: hfText = "&Z&F"; break;

            default: throw new NotImplementedException();
            }
            return(AddText(hfText, occurrence));
        }
        internal String SetInnerText(XLHFOccurrence occurrence, String text)
        { 
            if (innerTexts.ContainsKey(occurrence))
                innerTexts[occurrence] = text;
            else
                innerTexts.Add(occurrence, text);

            return innerTexts[occurrence];
        }
Ejemplo n.º 8
0
        public String GetText(XLHFOccurrence occurrence)
        {
            var sb = new StringBuilder();
            if(texts.ContainsKey(occurrence))
            {
                foreach (var hfText in texts[occurrence])
                    sb.Append(hfText.GetHFText(sb.ToString()));
            }

            return sb.ToString();
        }
Ejemplo n.º 9
0
 private void AddTextToOccurrence(XLHFText hfText, XLHFOccurrence occurrence)
 {
     if (texts.ContainsKey(occurrence))
     {
         texts[occurrence].Add(hfText);
     }
     else
     {
         texts.Add(occurrence, new List <XLHFText> {
             hfText
         });
     }
 }
Ejemplo n.º 10
0
        internal String SetInnerText(XLHFOccurrence occurrence, String text)
        {
            if (innerTexts.ContainsKey(occurrence))
            {
                innerTexts[occurrence] = text;
            }
            else
            {
                innerTexts.Add(occurrence, text);
            }

            return(innerTexts[occurrence]);
        }
Ejemplo n.º 11
0
 public void Clear(XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     if (occurrence == XLHFOccurrence.AllPages)
     {
         ClearOccurrence(XLHFOccurrence.EvenPages);
         ClearOccurrence(XLHFOccurrence.FirstPage);
         ClearOccurrence(XLHFOccurrence.OddPages);
     }
     else
     {
         ClearOccurrence(occurrence);
     }
 }
Ejemplo n.º 12
0
        public String GetText(XLHFOccurrence occurrence)
        {
            var sb = new StringBuilder();

            if (texts.ContainsKey(occurrence))
            {
                foreach (var hfText in texts[occurrence])
                {
                    sb.Append(hfText.GetHFText(sb.ToString()));
                }
            }

            return(sb.ToString());
        }
Ejemplo n.º 13
0
        public String GetText(XLHFOccurrence occurrence)
        {
            var sb = new StringBuilder();

            if (texts.TryGetValue(occurrence, out List <XLHFText> hfTexts))
            {
                foreach (var hfText in hfTexts)
                {
                    sb.Append(hfText.GetHFText(sb.ToString()));
                }
            }

            return(sb.ToString());
        }
Ejemplo n.º 14
0
        private void AddTextToOccurrence(XLHFText hfText, XLHFOccurrence occurrence)
        {
            if (texts.TryGetValue(occurrence, out List <XLHFText> hfTexts))
            {
                hfTexts.Add(hfText);
            }
            else
            {
                texts.Add(occurrence, new List <XLHFText> {
                    hfText
                });
            }

            this.HeaderFooter.Changed = true;
        }
Ejemplo n.º 15
0
        public String GetText(XLHFOccurrence occurrence)
        {
            if (innerTexts.ContainsKey(occurrence)) return innerTexts[occurrence];

            var retVal = String.Empty;
            var leftText = Left.GetText(occurrence);
            var centerText = Center.GetText(occurrence);
            var rightText = Right.GetText(occurrence);
            retVal += leftText.Length > 0 ? "&L" + leftText : String.Empty;
            retVal += centerText.Length > 0 ? "&C" + centerText : String.Empty;
            retVal += rightText.Length > 0 ? "&R" + rightText : String.Empty;
            if (retVal.Length > 255)
                throw new ArgumentOutOfRangeException("Headers and Footers cannot be longer than 255 characters (including style markups)");
            return retVal;
        }
Ejemplo n.º 16
0
        private void AddTextToOccurrence(XLHFText hfText, XLHFOccurrence occurrence)
        {
            if (texts.ContainsKey(occurrence))
            {
                texts[occurrence].Add(hfText);
            }
            else
            {
                texts.Add(occurrence, new List <XLHFText> {
                    hfText
                });
            }

            this.HeaderFooter.Changed = true;
        }
Ejemplo n.º 17
0
 public IXLRichString AddText(XLHFPredefinedText predefinedText, XLHFOccurrence occurrence)
 {
     String hfText;
     switch (predefinedText)
     {
         case XLHFPredefinedText.PageNumber: hfText = "&P"; break;
         case XLHFPredefinedText.NumberOfPages : hfText = "&N"; break;
         case XLHFPredefinedText.Date : hfText = "&D"; break;
         case XLHFPredefinedText.Time : hfText = "&T"; break;
         case XLHFPredefinedText.Path : hfText = "&Z"; break;
         case XLHFPredefinedText.File : hfText = "&F"; break;
         case XLHFPredefinedText.SheetName : hfText = "&A"; break;
         case XLHFPredefinedText.FullPath: hfText = "&Z&F"; break;
         default: throw new NotImplementedException();
     }
     return AddText(hfText, occurrence);
 }
Ejemplo n.º 18
0
        public IXLRichString AddText(String text, XLHFOccurrence occurrence)
        {
            XLRichString richText = new XLRichString(text, XLWorkbook.DefaultStyle.Font, this);

            var hfText = new XLHFText(richText, _worksheet);
            if (occurrence == XLHFOccurrence.AllPages)
            {
                AddTextToOccurrence(hfText, XLHFOccurrence.EvenPages);
                AddTextToOccurrence(hfText, XLHFOccurrence.FirstPage);
                AddTextToOccurrence(hfText, XLHFOccurrence.OddPages);
            }
            else
            {
                AddTextToOccurrence(hfText, occurrence);
            }

            return richText;
        }
Ejemplo n.º 19
0
        public String GetText(XLHFOccurrence occurrence)
        {
            //if (innerTexts.ContainsKey(occurrence)) return innerTexts[occurrence];

            var retVal     = String.Empty;
            var leftText   = Left.GetText(occurrence);
            var centerText = Center.GetText(occurrence);
            var rightText  = Right.GetText(occurrence);

            retVal += leftText.Length > 0 ? "&L" + leftText : String.Empty;
            retVal += centerText.Length > 0 ? "&C" + centerText : String.Empty;
            retVal += rightText.Length > 0 ? "&R" + rightText : String.Empty;
            if (retVal.Length > 255)
            {
                throw new ArgumentOutOfRangeException("Headers and Footers cannot be longer than 255 characters (including style markups)");
            }
            return(retVal);
        }
Ejemplo n.º 20
0
        public IXLRichString AddText(String text, XLHFOccurrence occurrence)
        {
            XLRichString richText = new XLRichString(text, XLWorkbook.DefaultStyle.Font, this);

            var hfText = new XLHFText(richText, _worksheet);

            if (occurrence == XLHFOccurrence.AllPages)
            {
                AddTextToOccurrence(hfText, XLHFOccurrence.EvenPages);
                AddTextToOccurrence(hfText, XLHFOccurrence.FirstPage);
                AddTextToOccurrence(hfText, XLHFOccurrence.OddPages);
            }
            else
            {
                AddTextToOccurrence(hfText, occurrence);
            }

            return(richText);
        }
Ejemplo n.º 21
0
 public IXLRichString AddImage(String imagePath, XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
 public IXLRichString AddImage(String imagePath, XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 23
0
 public void Clear(XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     if (occurrence == XLHFOccurrence.AllPages)
     {
         ClearOccurrence(XLHFOccurrence.EvenPages);
         ClearOccurrence(XLHFOccurrence.FirstPage);
         ClearOccurrence(XLHFOccurrence.OddPages);
     }
     else
     {
         ClearOccurrence(occurrence);
     }
 }
Ejemplo n.º 24
0
 private void ClearOccurrence(XLHFOccurrence occurrence)
 {
     if (texts.ContainsKey(occurrence))
         texts.Remove(occurrence);
 }
Ejemplo n.º 25
0
 public void FooterLeft(XLHFPredefinedText _text, XLHFOccurrence _xlhfOccurence)
 {
     ws.PageSetup.Footer.Left.AddText(_text, _xlhfOccurence);
 }
Ejemplo n.º 26
0
 public void FooterLeft(string _text, XLHFOccurrence _xlhfOccurence)
 {
     ws.PageSetup.Footer.Left.AddText(_text, _xlhfOccurence);
 }
Ejemplo n.º 27
0
 public void FooterCenter(string _text, XLHFOccurrence _xlhfOccurence)
 {
     ws.PageSetup.Footer.Center.AddText(_text, _xlhfOccurence);
 }