Exemple #1
0
 /// <summary>
 /// Calculate the displayMode property
 /// </summary>
 /// <param name="ordering">Ordering Trend sample options</param>
 /// <param name="condense">Condense method options</param>
 /// <param name="stretch">Stretch method options</param>
 /// <param name="gapFill">Gap Fill Constant option (the number of missed samples that the user wants to gap fill)</param>
 /// <param name="badQuality">Last valid value option</param>
 /// <param name="raw">Raw data option</param>
 /// <returns>Options for formatting and calculating the samples of the query as an unsigned integer.</returns>
 public static uint Get(
     Ordering ordering     = Ordering.OldestToNewest,
     Condense condense     = Condense.Mean,
     Stretch stretch       = Stretch.Step,
     uint gapFill          = 0,
     BadQuality badQuality = BadQuality.Zero,
     Raw raw = Raw.None)
 {
     return((uint)ordering + (uint)condense + (uint)stretch + (gapFill * 4096) + (uint)badQuality + (uint)raw);
 }
Exemple #2
0
        // Generates content of workbookStylesPart1.
        private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
        {
            Stylesheet stylesheet1 = new Stylesheet();

            Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U };

            Font font1 = new Font();
            FontSize fontSize1 = new FontSize() { Val = 11D };
            Color color1 = new Color() { Theme = (UInt32Value)1U };
            FontName fontName1 = new FontName() { Val = "Calibri" };
            FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 };
            FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor };

            font1.Append(fontSize1);
            font1.Append(color1);
            font1.Append(fontName1);
            font1.Append(fontFamilyNumbering1);
            font1.Append(fontScheme1);

            fonts1.Append(font1);

            Fills fills1 = new Fills() { Count = (UInt32Value)2U };

            Fill fill1 = new Fill();
            PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None };

            fill1.Append(patternFill1);

            Fill fill2 = new Fill();
            PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 };

            fill2.Append(patternFill2);

            fills1.Append(fill1);
            fills1.Append(fill2);

            Borders borders1 = new Borders() { Count = (UInt32Value)1U };

            Border border1 = new Border();
            LeftBorder leftBorder1 = new LeftBorder();
            RightBorder rightBorder1 = new RightBorder();
            TopBorder topBorder1 = new TopBorder();
            BottomBorder bottomBorder1 = new BottomBorder();
            DiagonalBorder diagonalBorder1 = new DiagonalBorder();

            border1.Append(leftBorder1);
            border1.Append(rightBorder1);
            border1.Append(topBorder1);
            border1.Append(bottomBorder1);
            border1.Append(diagonalBorder1);

            borders1.Append(border1);

            CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U };
            CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U };

            cellStyleFormats1.Append(cellFormat1);

            CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)1U };
            CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U };

            cellFormats1.Append(cellFormat2);

            CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U };
            CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U };

            cellStyles1.Append(cellStyle1);

            DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)3U };

            DifferentialFormat differentialFormat1 = new DifferentialFormat();

            Font font2 = new Font();
            Condense condense1 = new Condense() { Val = false };
            Extend extend1 = new Extend() { Val = false };
            Color color2 = new Color() { Rgb = "FF9C0006" };

            font2.Append(condense1);
            font2.Append(extend1);
            font2.Append(color2);

            Fill fill3 = new Fill();

            PatternFill patternFill3 = new PatternFill();
            BackgroundColor backgroundColor1 = new BackgroundColor() { Rgb = "FFFFC7CE" };

            patternFill3.Append(backgroundColor1);

            fill3.Append(patternFill3);

            differentialFormat1.Append(font2);
            differentialFormat1.Append(fill3);

            DifferentialFormat differentialFormat2 = new DifferentialFormat();

            Font font3 = new Font();
            Condense condense2 = new Condense() { Val = false };
            Extend extend2 = new Extend() { Val = false };
            Color color3 = new Color() { Rgb = "FF006100" };

            font3.Append(condense2);
            font3.Append(extend2);
            font3.Append(color3);

            Fill fill4 = new Fill();

            PatternFill patternFill4 = new PatternFill();
            BackgroundColor backgroundColor2 = new BackgroundColor() { Rgb = "FFC6EFCE" };

            patternFill4.Append(backgroundColor2);

            fill4.Append(patternFill4);

            differentialFormat2.Append(font3);
            differentialFormat2.Append(fill4);

            DifferentialFormat differentialFormat3 = new DifferentialFormat();

            Font font4 = new Font();
            Condense condense3 = new Condense() { Val = false };
            Extend extend3 = new Extend() { Val = false };
            Color color4 = new Color() { Rgb = "FF006100" };

            font4.Append(condense3);
            font4.Append(extend3);
            font4.Append(color4);

            Fill fill5 = new Fill();

            PatternFill patternFill5 = new PatternFill();
            BackgroundColor backgroundColor3 = new BackgroundColor() { Rgb = "FFC6EFCE" };

            patternFill5.Append(backgroundColor3);

            fill5.Append(patternFill5);

            differentialFormat3.Append(font4);
            differentialFormat3.Append(fill5);

            differentialFormats1.Append(differentialFormat1);
            differentialFormats1.Append(differentialFormat2);
            differentialFormats1.Append(differentialFormat3);
            TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" };

            stylesheet1.Append(fonts1);
            stylesheet1.Append(fills1);
            stylesheet1.Append(borders1);
            stylesheet1.Append(cellStyleFormats1);
            stylesheet1.Append(cellFormats1);
            stylesheet1.Append(cellStyles1);
            stylesheet1.Append(differentialFormats1);
            stylesheet1.Append(tableStyles1);

            workbookStylesPart1.Stylesheet = stylesheet1;
        }
Exemple #3
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 17;

                hash = hash * 23 + Name.GetHashCode();
                if (Size != null)
                {
                    hash = hash * 23 + Size.GetHashCode();
                }
                if (FontFamily != null)
                {
                    hash = hash * 23 + FontFamily.GetHashCode();
                }
                if (VerticalTextAlignment != null)
                {
                    hash = hash * 23 + VerticalTextAlignment.GetHashCode();
                }
                if (Underline != null)
                {
                    hash = hash * 23 + Underline.GetHashCode();
                }
                if (Shadow != null)
                {
                    hash = hash * 23 + Shadow.GetHashCode();
                }
                if (Extend != null)
                {
                    hash = hash * 23 + Extend.GetHashCode();
                }
                if (FontCharSet != null)
                {
                    hash = hash * 23 + FontCharSet.GetHashCode();
                }
                if (Condense != null)
                {
                    hash = hash * 23 + Condense.GetHashCode();
                }
                if (Strike != null)
                {
                    hash = hash * 23 + Strike.GetHashCode();
                }
                if (Italic != null)
                {
                    hash = hash * 23 + Italic.GetHashCode();
                }
                if (Bold != null)
                {
                    hash = hash * 23 + Bold.GetHashCode();
                }
                if (Color != null)
                {
                    hash = hash * 23 + Color.GetHashCode();
                }
                if (FontScheme != null)
                {
                    hash = hash * 23 + FontScheme.GetHashCode();
                }

                return(hash);
            }
        }
Exemple #4
0
 private void blankToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     condense = Condense.BLANK;
     Generate();
 }
Exemple #5
0
 private void nULLToolStripMenuItem_Click(object sender, EventArgs e)
 {
     condense = Condense.NULL;
     Generate();
 }
Exemple #6
0
 private void noneToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     condense = Condense.None;
     Generate();
 }
Exemple #7
0
 private void lFCRToolStripMenuItem_Click(object sender, EventArgs e)
 {
     condense = Condense.LFCR;
     Generate();
 }
Exemple #8
0
 private void cRLFToolStripMenuItem_Click(object sender, EventArgs e)
 {
     condense = Condense.CRLF;
     Generate();
 }
        internal void FromRun(Run r)
        {
            this.SetAllNull();

            using (OpenXmlReader oxr = OpenXmlReader.Create(r))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Text))
                    {
                        this.Text = ((Text)oxr.LoadCurrentElement()).Text;
                    }
                    else if (oxr.ElementType == typeof(RunFont))
                    {
                        RunFont rft = (RunFont)oxr.LoadCurrentElement();
                        if (rft.Val != null)
                        {
                            this.Font.FontName = rft.Val.Value;
                        }
                    }
                    else if (oxr.ElementType == typeof(RunPropertyCharSet))
                    {
                        RunPropertyCharSet rpcs = (RunPropertyCharSet)oxr.LoadCurrentElement();
                        if (rpcs.Val != null)
                        {
                            this.Font.CharacterSet = rpcs.Val.Value;
                        }
                    }
                    else if (oxr.ElementType == typeof(FontFamily))
                    {
                        FontFamily ff = (FontFamily)oxr.LoadCurrentElement();
                        if (ff.Val != null)
                        {
                            this.Font.FontFamily = ff.Val.Value;
                        }
                    }
                    else if (oxr.ElementType == typeof(Bold))
                    {
                        Bold b = (Bold)oxr.LoadCurrentElement();
                        if (b.Val != null)
                        {
                            this.Font.Bold = b.Val.Value;
                        }
                        else
                        {
                            this.Font.Bold = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Italic))
                    {
                        Italic itlc = (Italic)oxr.LoadCurrentElement();
                        if (itlc.Val != null)
                        {
                            this.Font.Italic = itlc.Val.Value;
                        }
                        else
                        {
                            this.Font.Italic = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Strike))
                    {
                        Strike strk = (Strike)oxr.LoadCurrentElement();
                        if (strk.Val != null)
                        {
                            this.Font.Strike = strk.Val.Value;
                        }
                        else
                        {
                            this.Font.Strike = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Outline))
                    {
                        Outline outln = (Outline)oxr.LoadCurrentElement();
                        if (outln.Val != null)
                        {
                            this.Font.Outline = outln.Val.Value;
                        }
                        else
                        {
                            this.Font.Outline = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Shadow))
                    {
                        Shadow shdw = (Shadow)oxr.LoadCurrentElement();
                        if (shdw.Val != null)
                        {
                            this.Font.Shadow = shdw.Val.Value;
                        }
                        else
                        {
                            this.Font.Shadow = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Condense))
                    {
                        Condense cdns = (Condense)oxr.LoadCurrentElement();
                        if (cdns.Val != null)
                        {
                            this.Font.Condense = cdns.Val.Value;
                        }
                        else
                        {
                            this.Font.Condense = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Extend))
                    {
                        Extend ext = (Extend)oxr.LoadCurrentElement();
                        if (ext.Val != null)
                        {
                            this.Font.Extend = ext.Val.Value;
                        }
                        else
                        {
                            this.Font.Extend = true;
                        }
                    }
                    else if (oxr.ElementType == typeof(Color))
                    {
                        this.Font.clrFontColor.FromSpreadsheetColor((Color)oxr.LoadCurrentElement());
                        this.Font.HasFontColor = !this.Font.clrFontColor.IsEmpty();
                    }
                    else if (oxr.ElementType == typeof(FontSize))
                    {
                        FontSize ftsz = (FontSize)oxr.LoadCurrentElement();
                        if (ftsz.Val != null)
                        {
                            this.Font.FontSize = ftsz.Val.Value;
                        }
                    }
                    else if (oxr.ElementType == typeof(Underline))
                    {
                        Underline und = (Underline)oxr.LoadCurrentElement();
                        if (und.Val != null)
                        {
                            this.Font.Underline = und.Val.Value;
                        }
                        else
                        {
                            this.Font.Underline = UnderlineValues.Single;
                        }
                    }
                    else if (oxr.ElementType == typeof(VerticalTextAlignment))
                    {
                        VerticalTextAlignment vta = (VerticalTextAlignment)oxr.LoadCurrentElement();
                        if (vta.Val != null)
                        {
                            this.Font.VerticalAlignment = vta.Val.Value;
                        }
                    }
                    else if (oxr.ElementType == typeof(FontScheme))
                    {
                        FontScheme ftsch = (FontScheme)oxr.LoadCurrentElement();
                        if (ftsch.Val != null)
                        {
                            this.Font.FontScheme = ftsch.Val.Value;
                        }
                    }
                }
            }
        }