Esempio n. 1
0
 public IXLHeaderFooter Clear(XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     Left.Clear(occurrence);
     Right.Clear(occurrence);
     Center.Clear(occurrence);
     return this;
 }
Esempio n. 2
0
 public IXLHeaderFooter Clear(XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     Left.Clear(occurrence);
     Right.Clear(occurrence);
     Center.Clear(occurrence);
     return(this);
 }
Esempio 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]);
        }
Esempio 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 });
 }
Esempio n. 5
0
 private void ClearOccurrence(XLHFOccurrence occurrence)
 {
     if (texts.ContainsKey(occurrence))
     {
         texts.Remove(occurrence);
     }
 }
Esempio 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];
        }
Esempio 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();
        }
Esempio 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
         });
     }
 }
Esempio 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]);
        }
Esempio 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);
     }
 }
Esempio 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());
        }
Esempio 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());
        }
Esempio 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;
        }
Esempio 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;
        }
Esempio 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;
        }
Esempio 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);
 }
Esempio 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;
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 21
0
 public IXLRichString AddImage(String imagePath, XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     throw new NotImplementedException();
 }
Esempio n. 22
0
 public IXLRichString AddImage(String imagePath, XLHFOccurrence occurrence = XLHFOccurrence.AllPages)
 {
     throw new NotImplementedException();
 }
Esempio 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);
     }
 }
Esempio n. 24
0
 private void ClearOccurrence(XLHFOccurrence occurrence)
 {
     if (texts.ContainsKey(occurrence))
         texts.Remove(occurrence);
 }
Esempio n. 25
0
 public void FooterLeft(XLHFPredefinedText _text, XLHFOccurrence _xlhfOccurence)
 {
     ws.PageSetup.Footer.Left.AddText(_text, _xlhfOccurence);
 }
Esempio n. 26
0
 public void FooterLeft(string _text, XLHFOccurrence _xlhfOccurence)
 {
     ws.PageSetup.Footer.Left.AddText(_text, _xlhfOccurence);
 }
Esempio n. 27
0
 public void FooterCenter(string _text, XLHFOccurrence _xlhfOccurence)
 {
     ws.PageSetup.Footer.Center.AddText(_text, _xlhfOccurence);
 }