Exemple #1
0
        private void ApplyFont(SLFont font, FontStyle fontStyle)
        {
            if (fontStyle == null)
            {
                return;
            }

            font.FontName = fontStyle.FontName;
            font.Bold     = fontStyle.IsBold;
            font.Italic   = fontStyle.IsItalic;
            font.Strike   = fontStyle.IsStrikeout;

            font.VerticalAlignment = this.GetFontSuperScript(fontStyle.ScriptStyle);
            font.Underline         = this.GetFontUnderLine(fontStyle.Underline);

            if (fontStyle.Size != 0m)
            {
                font.FontSize = Convert.ToDouble(fontStyle.Size);
            }

            if (fontStyle.Color.HasValue)
            {
                var color = fontStyle.Color.Value;
                font.FontColor = System.Drawing.Color.FromArgb(color.Alpha, color.Red, color.Green, color.Blue);
            }
        }
        /// <summary>
        ///     Append given text in the current theme's minor font and default font size.
        /// </summary>
        /// <param name="Text">The text.</param>
        public void AppendText(string Text)
        {
            var font = new SLFont(MajorFont, MinorFont, listThemeColors, listIndexedColors);

            font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize);

            AppendText(Text, font);
        }
Exemple #3
0
 internal SLDataTable(List<System.Drawing.Color> ThemeColors)
 {
     this.ShowHorizontalBorder = true;
     this.ShowVerticalBorder = true;
     this.ShowOutlineBorder = true;
     this.ShowLegendKeys = true;
     this.ShapeProperties = new SLA.SLShapeProperties(ThemeColors);
     this.Font = null;
 }
        //For each sheet in the publishing form folder, create a metadata sheet by deleting the unneeded columns
        public void createMetadata()
        {
            listFileNames(folderPath);
            foreach (var f in pubforms)
            {
                SLDocument sl = new SLDocument(folderPath + "\\" + f.Value);

                //Select Publishing tab
                sl.SelectWorksheet(MetaPresTab);

                //Try and rename something in the header row
                //Big "Source"
                //Small "Global master slides or locally developed slides that maintain the main message of that slide = GL; otherwise set to LO"
                //D34
                SLRstType Heading1 = new SLRstType();
                SLFont    Big      = new SLFont();
                SLFont    Small    = new SLFont();
                Big.Bold = true;
                Big.SetFont("Calibri", 14);
                Small.SetFont("Calibri", 9);
                Heading1.AppendText("PBSource", Big);
                Heading1.AppendText("Global PB master slides or locally developed slides that maintain the main message of that slide = GL; otherwise set to LO", Small);
                sl.SetCellValue("D" + (metakeymessagestartrow - 1), Heading1);

                /*
                 * // delete 1 column at column 6 - sl.DeleteColumn(6, 1);
                 * foreach (var i in NonMetadataColumns)
                 * {
                 *  sl.DeleteColumn(i, 1);
                 * }
                 *
                 * foreach (var i in NonMetadataRows)
                 * {
                 *  sl.DeleteRow(i, 1);
                 * }
                 */


                sl.SaveAs(folderPath + "\\METADATATEST-" + f.Value + ".xlsx");
            }
        }
Exemple #5
0
        internal SLDataTable(List <System.Drawing.Color> ThemeColors, bool IsStylish, bool ThrowExceptionsIfAny)
        {
            this.ShowHorizontalBorder = true;
            this.ShowVerticalBorder   = true;
            this.ShowOutlineBorder    = true;
            this.ShowLegendKeys       = true;
            this.ShapeProperties      = new SLA.SLShapeProperties(ThemeColors, ThrowExceptionsIfAny);

            if (IsStylish)
            {
                this.ShapeProperties.Fill.SetNoFill();
                this.ShapeProperties.Outline.Width            = 0.75m;
                this.ShapeProperties.Outline.CapType          = A.LineCapValues.Flat;
                this.ShapeProperties.Outline.CompoundLineType = A.CompoundLineValues.Single;
                this.ShapeProperties.Outline.Alignment        = A.PenAlignmentValues.Center;
                this.ShapeProperties.Outline.SetSolidLine(A.SchemeColorValues.Text1, 0.85m, 0);
                this.ShapeProperties.Outline.JoinType = SLA.SLLineJoinValues.Round;
            }

            this.Font = null;
        }
Exemple #6
0
        /// <summary> создаение списка критериев </summary>
        protected void CreateCriteriaList(Dictionary <string, string> criteria, int width)
        {
            foreach (var key in criteria.Keys)
            {
                SLFont captionFont = Document.CreateFont();
                captionFont.FontName = FontName;
                captionFont.FontSize = FontSize;
                captionFont.Bold     = true;

                SLFont valueFont = Document.CreateFont();
                valueFont.FontName = FontName;
                valueFont.FontSize = FontSize;

                SLRstType rstType = Document.CreateRstType();

                rstType.AppendText(key + ": ", captionFont);
                rstType.AppendText(criteria[key], valueFont);

                Document.SetCellValue(LineNum, 1, rstType.ToInlineString());

                Document.MergeWorksheetCells(LineNum, 1, LineNum, width);
                LineNum++;
            }
        }
 /// <summary>
 /// Set font settings for the contents of the data table.
 /// </summary>
 /// <param name="Font">The SLFont containing the font settings.</param>
 public void SetFont(SLFont Font)
 {
     this.Font = Font.Clone();
 }
Exemple #8
0
 /// <summary>
 /// Set font settings for the contents of the data table.
 /// </summary>
 /// <param name="Font">The SLFont containing the font settings.</param>
 public void SetFont(SLFont Font)
 {
     this.Font = Font.Clone();
 }
        /// <summary>
        ///     Append given text with a given font style.
        /// </summary>
        /// <param name="Text">The text.</param>
        /// <param name="TextFont">The font style.</param>
        public void AppendText(string Text, SLFont TextFont)
        {
            var run      = new Run();
            var runprops = new RunProperties();

            if (TextFont.FontName != null)
            {
                runprops.Append(new RunFont {
                    Val = TextFont.FontName
                });
            }

            if (TextFont.CharacterSet != null)
            {
                runprops.Append(new RunPropertyCharSet {
                    Val = TextFont.CharacterSet.Value
                });
            }

            if (TextFont.FontFamily != null)
            {
                runprops.Append(new FontFamily {
                    Val = TextFont.FontFamily.Value
                });
            }

            if (TextFont.Bold != null)
            {
                runprops.Append(new Bold {
                    Val = TextFont.Bold.Value
                });
            }

            if (TextFont.Italic != null)
            {
                runprops.Append(new Italic {
                    Val = TextFont.Italic.Value
                });
            }

            if (TextFont.Strike != null)
            {
                runprops.Append(new Strike {
                    Val = TextFont.Strike.Value
                });
            }

            if (TextFont.Outline != null)
            {
                runprops.Append(new Outline {
                    Val = TextFont.Outline.Value
                });
            }

            if (TextFont.Shadow != null)
            {
                runprops.Append(new Shadow {
                    Val = TextFont.Shadow.Value
                });
            }

            if (TextFont.Condense != null)
            {
                runprops.Append(new Condense {
                    Val = TextFont.Condense.Value
                });
            }

            if (TextFont.Extend != null)
            {
                runprops.Append(new Extend {
                    Val = TextFont.Extend.Value
                });
            }

            if (TextFont.HasFontColor)
            {
                runprops.Append(TextFont.clrFontColor.ToSpreadsheetColor());
            }

            if (TextFont.FontSize != null)
            {
                runprops.Append(new FontSize {
                    Val = TextFont.FontSize.Value
                });
            }

            if (TextFont.HasUnderline)
            {
                runprops.Append(new Underline {
                    Val = TextFont.Underline
                });
            }

            if (TextFont.HasVerticalAlignment)
            {
                runprops.Append(new VerticalTextAlignment {
                    Val = TextFont.VerticalAlignment
                });
            }

            if (TextFont.HasFontScheme)
            {
                runprops.Append(new FontScheme {
                    Val = TextFont.FontScheme
                });
            }

            if (runprops.ChildElements.Count > 0)
            {
                run.Append(runprops);
            }

            run.Text      = new Text();
            run.Text.Text = Text;
            if (SLTool.ToPreserveSpace(Text))
            {
                run.Text.Space = SpaceProcessingModeValues.Preserve;
            }

            var bFound = false;
            var oxe    = istrReal.FirstChild;

            foreach (var child in istrReal.ChildElements)
            {
                if (child is Text || child is Run)
                {
                    oxe    = child;
                    bFound = true;
                }
            }

            if (bFound)
            {
                istrReal.InsertAfter(run, oxe);
            }
            else
            {
                istrReal.PrependChild(run);
            }
        }
Exemple #10
0
 private void SetAllNull()
 {
     Font = new SLFont(SLConstants.OfficeThemeMajorLatinFont, SLConstants.OfficeThemeMinorLatinFont,
                       new List <Color>(), new List <Color>());
     Text = string.Empty;
 }