// Adds child parts and generates content of the specified part.
        public static void CreateTable(WorkbookPart workbookPart, WorksheetPart worksheetPart, string[] columns, int topLeftColumn, int topLeftRow, int width, int height)
        {
            List<WorksheetPart> worksheets = workbookPart.GetPartsOfType<WorksheetPart>().ToList();
            uint maxTableId = worksheets.Select(ws => ws.TableDefinitionParts.ToList()).SelectMany(tableDefinitions => tableDefinitions).Aggregate<TableDefinitionPart, uint>(0, (current, tableDef) => Math.Max(tableDef.Table.Id, current));

            uint tableId = maxTableId + 1;

            var tables = new TableParts { Count = 1U };
            worksheetPart.Worksheet.Append((IEnumerable<OpenXmlElement>)tables);

            var newTableDefnPart = worksheetPart.AddNewPart<TableDefinitionPart>();
            string relationshipId = worksheetPart.GetIdOfPart(newTableDefnPart);

            string cellReference = string.Format("{0}{1}:{2}{3}", GetColumnIdentifier(topLeftColumn), topLeftRow, GetColumnIdentifier(topLeftColumn + width - 1), topLeftRow + height);
            var table1 = new Table { Id = tableId, Name = "Table" + relationshipId, DisplayName = "Table" + relationshipId, Reference = cellReference, TotalsRowShown = false };
            var autoFilter1 = new AutoFilter { Reference = cellReference };

            var tableColumns1 = new TableColumns { Count = (uint)columns.Length };
            for (int iColumn = 0; iColumn < columns.Length; iColumn++)
            {
                var tableColumn = new TableColumn { Id = (UInt32Value)(uint)iColumn + 1, Name = columns[iColumn] };
                tableColumns1.Append((IEnumerable<OpenXmlElement>)tableColumn);
            }
            var tableStyleInfo1 = new TableStyleInfo { Name = "TableStyleMedium2", ShowFirstColumn = false, ShowLastColumn = false, ShowRowStripes = true, ShowColumnStripes = false };

            table1.Append((IEnumerable<OpenXmlElement>)autoFilter1);
            table1.Append((IEnumerable<OpenXmlElement>)tableColumns1);
            table1.Append((IEnumerable<OpenXmlElement>)tableStyleInfo1);

            newTableDefnPart.Table = table1;

            var table = new TablePart { Id = relationshipId };
            tables.Append((IEnumerable<OpenXmlElement>)table);

            //TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9" };
            //worksheetPart.Worksheet.Append(tableStyles1);
        }
        protected override void FillUpReport(IEnumerable <CalculationMethod> calculationMethods, ReportPart reportPart)
        {
            var calcMethodPart = new TablePart(keyName: PKSimConstants.UI.Category, valueName: PKSimConstants.UI.CalculationMethods)
            {
                Title = PKSimConstants.UI.CalculationMethods
            };

            foreach (var calculationMethod in calculationMethods)
            {
                var currentCalculationMethod = calculationMethod;
                var category = _calculationMethodCategoryRepository.FindBy(currentCalculationMethod.Category);
                var allCalculationMethods = category.AllItems().ToList();
                if (allCalculationMethods.Count == 1)
                {
                    continue;
                }

                //more than one cm in this category. Check that this is not only due to different models
                allCalculationMethods.Remove(calculationMethod);
                var allModelsUsedInCategory  = allCalculationMethods.SelectMany(x => x.AllModels).Distinct();
                var allSpeciesUsedInCategory = allCalculationMethods.SelectMany(x => x.AllSpecies).Distinct();

                //at least another category available in the model and species
                if (allModelsUsedInCategory.Any(x => currentCalculationMethod.AllModels.Contains(x)) &&
                    allSpeciesUsedInCategory.Any(x => currentCalculationMethod.AllSpecies.Contains(x)))
                {
                    calcMethodPart.AddIs(_representationInfoRepository.DisplayNameFor(category),
                                         _representationInfoRepository.DisplayNameFor(calculationMethod));
                }
            }

            reportPart.AddPart(calcMethodPart);
        }
示例#3
0
        /// <summary>
        /// Gets a whole column row for the specific column row part.
        /// </summary>
        /// <param name="part">The column row part.</param>
        /// <param name="widths">The column widths.</param>
        /// <param name="columns">The columns.</param>
        /// <returns>A string representing the column row.</returns>
        public virtual string GetColumnRow(TablePart part, IReadOnlyList <int> widths, IReadOnlyList <IColumn> columns)
        {
            if (widths is null)
            {
                throw new ArgumentNullException(nameof(widths));
            }

            if (columns is null)
            {
                throw new ArgumentNullException(nameof(columns));
            }

            var(left, center, separator, right) = GetTableParts(part);

            var builder = new StringBuilder();

            builder.Append(left);

            foreach (var(columnIndex, _, lastColumn, columnWidth) in widths.Enumerate())
            {
                var padding     = columns[columnIndex].Padding;
                var centerWidth = padding.GetLeftSafe() + columnWidth + padding.GetRightSafe();
                builder.Append(center.Repeat(centerWidth));

                if (!lastColumn)
                {
                    builder.Append(separator);
                }
            }

            builder.Append(right);
            return(builder.ToString());
        }
示例#4
0
    void        AttachItem(int itemID)
    {
        Body body = UToolS.SelectBody();

        if (body != null)
        {
            var       partlist = Creation.ReadShipObject(body.gameObject); OpShip.OSIDE seldir;
            var       selpart = OpShip.GetInsertParent(partlist, itemID, out seldir);
            TablePart newpart = OpShip.NewInsertItem(selpart, seldir, itemID);

            Item item = Creation.MakeItemObject(newpart, body.transform);
            item.renderer.material = MainRenderer.GetMeterial(item.gameObject, body.tone);

            if (newpart.posx != 0)
            {
                TablePart newpair = newpart;
                newpair.posx = -newpart.posx;
                newpair.flip = (byte)(newpart.flip == 1 ? 0 : 1);
                if (newpart.angle == 90 || newpart.angle == -90 || newpart.angle == 270)
                {
                    newpair.angle = IMath.GetCenterDegree(newpart.angle + 180);
                }

                Item itemPair = Creation.MakeItemObject(newpair, body.transform);
                itemPair.renderer.material = MainRenderer.GetMeterial(itemPair.gameObject, body.tone);
            }

            Creation.DepthSort(body.transform);
        }
    }
示例#5
0
        public override void Build(CompoundProperties compoundProperties, OSPSuiteTracker buildTracker)
        {
            var objectsToReport = new List <object>();
            var compoundConfig  = new TablePart(PKSimConstants.UI.Parameter, PKSimConstants.UI.AlternativeInCompound, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Caption = PKSimConstants.UI.CompoundConfiguration
            };

            compoundConfig.Types[PKSimConstants.UI.Value] = typeof(double);

            var compound = compoundProperties.Compound;

            foreach (var alternativeSelection in compoundProperties.CompoundGroupSelections)
            {
                var parameterName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, alternativeSelection.GroupName);
                var parameter     = getParameterForAlternative(compound, compoundProperties, alternativeSelection);
                compoundConfig.AddIs(parameterName, alternativeSelection.AlternativeName, ParameterMessages.DisplayValueFor(parameter, numericalDisplayOnly: true), ParameterMessages.DisplayUnitFor(parameter));
            }

            objectsToReport.Add(buildTracker.CreateRelativeStructureElement(PKSimConstants.UI.CompoundConfiguration, 2));
            objectsToReport.Add(compoundConfig);

            objectsToReport.Add(compoundProperties.AllCalculationMethods().Where(cm => cm.Category.IsOneOf(CoreConstants.Category.DistributionCellular, CoreConstants.Category.DistributionInterstitial, CoreConstants.Category.DiffusionIntCell)));

            _builderRepository.Report(objectsToReport, buildTracker);
        }
示例#6
0
        protected override IEnumerable <object> BuildingBlockReport(SimpleProtocol simpleProtocol, OSPSuiteTracker tracker)
        {
            var table = new TablePart(PKSimConstants.UI.Property, PKSimConstants.UI.Value);

            table.AddIs(PKSimConstants.UI.ProcessType, PKSimConstants.UI.SimpleProtocolMode);
            table.AddIs(PKSimConstants.UI.ApplicationType, simpleProtocol.ApplicationType.DisplayName);
            table.AddIs(PKSimConstants.UI.DosingInterval, simpleProtocol.DosingInterval.DisplayName);
            var parameters = new ParameterList(PKSimConstants.UI.Parameters, simpleProtocol.AllParameters().Where(simpleProtocol.ParameterShouldBeExported));

            return(new object[] { table, parameters });
        }
        protected override void FillUpReport(Formulation formulation, ReportPart reportPart)
        {
            reportPart.Title = _infoRepository.DisplayNameFor(RepresentationObjectType.CONTAINER, formulation.FormulationType);
            string parameterTableCaption = PKSimConstants.UI.ParametersDefinedIn(formulation.Name);

            if (formulation.IsDissolved)
            {
                reportPart.AddToContent(PKSimConstants.UI.NoParameter);
                return;
            }

            TablePart tablePart;

            if (!formulation.IsParticleDissolution)
            {
                var parameterList = new ParameterList(parameterTableCaption, formulation.AllVisibleParameters());
                tablePart = parameterList.ToTable(_infoRepository);
            }
            else
            {
                var particleDisperseSystem      = formulation.Parameter(Constants.Parameters.PARTICLE_DISPERSE_SYSTEM);
                var particleDistribution        = formulation.Parameter(Constants.Parameters.PARTICLE_SIZE_DISTRIBUTION);
                var displayParticleDistribution = _infoRepository.DisplayNameFor(particleDistribution);
                tablePart = new TablePart(PKSimConstants.UI.Parameter)
                {
                    Caption = parameterTableCaption
                };

                if (particleDisperseSystem.Value == CoreConstants.Parameters.MONODISPERSE)
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Monodisperse);
                    tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                }
                else
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Polydisperse);
                    if (particleDistribution.Value == CoreConstants.Parameters.PARTICLE_SIZE_DISTRIBUTION_NORMAL)
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.Normal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_STD_DEVIATION), _infoRepository);
                    }
                    else
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.LogNormal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_DISTRIBUTION_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_VARIATION_COEFF), _infoRepository);
                    }
                }
            }

            tablePart.Title = reportPart.Title;
            reportPart.AddPart(tablePart);
        }
示例#8
0
        public void creerTableau(WorksheetPart worksheetPart, DataTable dt, int indice)
        {
            obtentionBornesColonnes(dt);

            //Obtention des titres pour la creation des colonnes de la tables
            List <string> titres = new List <string>();

            foreach (DataColumn t in dt.Columns)
            {
                if (t.ColumnName != "style" && t.ColumnName != "graph")
                {
                    if (t.ColumnName == " ")
                    {
                        titres.Add("%");
                    }
                    else
                    {
                        titres.Add(t.ColumnName);
                    }
                }
            }

            //ecriture des titres
            SheetData sd = worksheetPart.Worksheet.GetFirstChild <SheetData>();
            Row       rr = XcelWin.creerTitres(dt, 1);

            sd.AppendChild(rr);

            //ecriture des données
            int index = 2;

            foreach (DataRow r in dt.Rows)
            {
                rr = XcelWin.creerLigne(r, index, 0, nbColonneConfig);
                sd.AppendChild(rr);
                index++;
            }

            XcelWin.AddTableDefinitionPart(worksheetPart, titres, dt.Rows.Count + 1, dt.Columns.Count - nbColonneConfig, indice);
            TableParts tableParts1 = new TableParts()
            {
                Count = (UInt32Value)1U
            };
            TablePart tablePart1 = new TablePart()
            {
                Id = "vId1"
            };

            tableParts1.Append(tablePart1);

            worksheetPart.Worksheet.Append(tableParts1);
        }
示例#9
0
        protected override void FillUpReport(OriginData originData, ReportPart reportPart)
        {
            var populationProperties = new TablePart(keyName: PKSimConstants.UI.PopulationProperties, valueName: PKSimConstants.UI.Value)
            {
                Title = PKSimConstants.UI.PopulationProperties
            };

            populationProperties.AddIs(PKSimConstants.UI.Species, originData.Species.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Population, originData.SpeciesPopulation.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Gender, originData.Gender.DisplayName);

            var individualProperties = new TablePart(PKSimConstants.UI.IndividualParameters, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Title = PKSimConstants.UI.IndividualParameters
            };

            individualProperties.Types[PKSimConstants.UI.Value] = typeof(double);
            if (originData.SpeciesPopulation.IsAgeDependent)
            {
                if (originData.Age.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Age, displayValueFor(originData.Age.Value, _dimensionRepository.AgeInYears, originData.AgeUnit), originData.AgeUnit);
                }

                if (originData.SpeciesPopulation.IsPreterm && originData.GestationalAge.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.GestationalAge, displayValueFor(originData.GestationalAge.Value, _dimensionRepository.AgeInWeeks, originData.GestationalAgeUnit), originData.GestationalAgeUnit);
                }
            }

            individualProperties.AddIs(PKSimConstants.UI.Weight, displayValueFor(originData.Weight, _dimensionRepository.Mass, originData.WeightUnit), originData.WeightUnit);

            if (originData.SpeciesPopulation.IsHeightDependent)
            {
                if (originData.Height.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Height, displayValueFor(originData.Height.Value, _dimensionRepository.Length, originData.HeightUnit), originData.HeightUnit);
                }

                if (originData.BMI.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.BMI, displayValueFor(originData.BMI.Value, _dimensionRepository.BMI, originData.BMIUnit), originData.BMIUnit);
                }
            }

            reportPart.AddPart(populationProperties);
            reportPart.AddPart(individualProperties);
            reportPart.AddPart(_reportGenerator.ReportFor(originData.SubPopulation));
            reportPart.AddPart(_reportGenerator.ReportFor(originData.AllCalculationMethods()));
        }
示例#10
0
        public TablePart ToTable(IRepresentationInfoRepository representationInfoRepository)
        {
            var table = new TablePart(PKSimConstants.UI.Parameter, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Caption = Caption
            };

            table.Types[PKSimConstants.UI.Value] = typeof(double);
            foreach (var parameter in _parameters)
            {
                table.AddIs(parameter, representationInfoRepository);
            }
            return(table);
        }
示例#11
0
        private string SelectDocumentTablePart_Script(TablePart table)
        {
            StringBuilder script = new StringBuilder();

            script.AppendLine("SELECT");
            script.AppendLine("\tT1.*");
            script.AppendLine($"FROM {Document.TableName} AS [T0]");
            script.AppendLine($"INNER JOIN {table.TableName} AS [T1]");
            script.AppendLine($"ON T0._IDRRef = T1.{Document.TableName}_IDRRef");
            script.AppendLine("WHERE T0._IDRRef = @Ref");
            script.AppendLine($"ORDER BY T1.{Document.TableName}_IDRRef ASC, T1._KeyField ASC");
            script.Append(";");
            return(script.ToString());
        }
示例#12
0
        public static void OutPut()
        {
            StackState s = RunEnvironment.Instance.LocalStack;
            //获得第一个参数
            ScriptObject arg1 = s.GetStackVar(0);

            TablePart tablePart = arg1.Value.RefPartHandle.ConverToTablePart();

            for (int i = 0; i < tablePart.Count; i++)
            {
                Console.Write(tablePart.ArrayPart[i].GetString() + " ");
            }

            s.SetReturnVoid();
        }
示例#13
0
        private void DefineTable(WorksheetPart worksheetPart, LineItem[] lineItems)
        {
            TableDefinitionPart tableDefinitionPart = worksheetPart.AddNewPart <TableDefinitionPart>("rId" + (worksheetPart.TableDefinitionParts.Count() + 1));
            int tableNo = worksheetPart.TableDefinitionParts.Count();

            string reference = $"A1:{((char)(64 + _fields.Length))}{lineItems.Length}";

            Table table = new Table()
            {
                Id = (UInt32)tableNo, Name = "Table" + tableNo, DisplayName = "Table" + tableNo, Reference = reference, TotalsRowShown = false
            };
            AutoFilter autoFilter = new AutoFilter()
            {
                Reference = reference
            };


            TableColumns tableColumns = new TableColumns()
            {
                Count = (UInt32)_fields.Length
            };

            for (int i = 0; i < _fields.Length; i++)
            {
                tableColumns.Append(new TableColumn()
                {
                    Id = (UInt32)(i + 1), Name = _fields[i]
                });
            }

            table.Append(autoFilter);
            table.Append(tableColumns);
            tableDefinitionPart.Table = table;

            TableParts tableParts = new TableParts()
            {
                Count = (UInt32)1
            };
            TablePart tablePart = new TablePart()
            {
                Id = "rId" + tableNo
            };

            tableParts.Append(tablePart);

            worksheetPart.Worksheet.Append(tableParts);
        }
示例#14
0
        public static void SetMetatable()
        {
            StackState s = RunEnvironment.Instance.LocalStack;

            ScriptObject arg1 = s.GetStackVar(0);

            ScriptObject arg2 = s.GetStackVar(1);

            if (arg1.Type != ScriptInterpreter.RunTime.ValueType.TABLE || arg2.Type != ScriptInterpreter.RunTime.ValueType.TABLE)
            {
                return;
            }

            TablePart table = arg1.Value.RefPartHandle.ConverToTablePart();

            table.MetaTable = arg2;
        }
        protected override void FillUpReport(CompoundProperties compoundProperties, ReportPart reportPart)
        {
            var processes      = compoundProperties.Processes;
            var compoundConfig = new TablePart(PKSimConstants.UI.Parameter, PKSimConstants.UI.AlternativeInCompound)
            {
                Title = PKSimConstants.UI.SimulationCompoundsConfiguration
            };


            foreach (var alternativeSelection in compoundProperties.CompoundGroupSelections)
            {
                var parameterName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, alternativeSelection.GroupName);
                compoundConfig.AddIs(parameterName, alternativeSelection.AlternativeName);
            }

            reportPart.AddPart(compoundConfig);
            reportPart.AddPart(_reportGenerator.ReportFor(processes.MetabolizationSelection).WithTitle(PKSimConstants.UI.SimulationMetabolism));
            reportPart.AddPart(_reportGenerator.ReportFor(processes.TransportAndExcretionSelection).WithTitle(PKSimConstants.UI.SimulationTransportAndExcretion));
            reportPart.AddPart(_reportGenerator.ReportFor(processes.SpecificBindingSelection).WithTitle(PKSimConstants.UI.SimulationSpecificBinding));
        }
示例#16
0
        protected override void FillUpReport(OriginData originData, ReportPart reportPart)
        {
            var populationProperties = new TablePart(keyName: PKSimConstants.UI.PopulationProperties, valueName: PKSimConstants.UI.Value)
            {
                Title = PKSimConstants.UI.PopulationProperties
            };

            populationProperties.AddIs(PKSimConstants.UI.Species, originData.Species.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Population, originData.Population.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Gender, originData.Gender.DisplayName);

            var individualProperties = new TablePart(PKSimConstants.UI.IndividualParameters, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Title = PKSimConstants.UI.IndividualParameters,
                Types =
                {
                    [PKSimConstants.UI.Value] = typeof(double)
                }
            };

            if (originData.Population.IsAgeDependent)
            {
                if (originData.Age != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Age, displayValueFor(originData.Age), originData.Age.Unit);
                }

                if (originData.Population.IsPreterm && originData.GestationalAge != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.GestationalAge, displayValueFor(originData.GestationalAge), originData.GestationalAge.Unit);
                }
            }

            individualProperties.AddIs(PKSimConstants.UI.Weight, displayValueFor(originData.Weight), originData.Weight.Unit);

            if (originData.Population.IsHeightDependent)
            {
                if (originData.Height != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Height, displayValueFor(originData.Height), originData.Height.Unit);
                }

                if (originData.BMI != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.BMI, displayValueFor(originData.BMI), originData.BMI.Unit);
                }
            }

            reportPart.AddPart(populationProperties);
            reportPart.AddPart(individualProperties);
            var diseaseState = originData.DiseaseState;

            if (diseaseState != null)
            {
                var diseaseStateProperties = new TablePart(PKSimConstants.UI.DiseaseState, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
                {
                    Title = diseaseState.DisplayName
                };
                originData.DiseaseStateParameters.Each(x =>
                {
                    var parameter   = diseaseState.Parameter(x.Name);
                    var displayName = _representationInfoRepository.DisplayNameFor(parameter);
                    diseaseStateProperties.AddIs(displayName, displayValueFor(x), x.Unit);
                });
                reportPart.AddPart(diseaseStateProperties);
            }

            reportPart.AddPart(_reportGenerator.ReportFor(originData.SubPopulation));
            reportPart.AddPart(_reportGenerator.ReportFor(originData.AllCalculationMethods()));
        }
示例#17
0
        /// <summary>
        ///     Generate Excel Document.
        /// </summary>
        /// <param name="queryResult">QueryResult</param>
        /// <returns>MemoryStream</returns>
        public static MemoryStream CreateExcelDocument(QueryResult queryResult)
        {
            var ms = new MemoryStream( );

            using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Create(ms, SpreadsheetDocumentType.Workbook, true))
            {
                // Create the Workbook
                WorkbookPart workbookPart = spreadSheet.AddWorkbookPart( );
                spreadSheet.WorkbookPart.Workbook = new Workbook( );

                // A Workbook must only have exactly one <Sheets> section
                spreadSheet.WorkbookPart.Workbook.AppendChild(new Sheets( ));

                var newWorksheetPart = spreadSheet.WorkbookPart.AddNewPart <WorksheetPart>( );
                newWorksheetPart.Worksheet = new Worksheet( );

                // Create a new Excel worksheet
                SheetData sheetData = newWorksheetPart.Worksheet.AppendChild(new SheetData( ));

                var tdp = newWorksheetPart.AddNewPart <TableDefinitionPart>( );

                string rId = newWorksheetPart.GetIdOfPart(tdp);
                var    T   = new Table
                {
                    Id             = 1U,
                    Name           = "MyTable",
                    DisplayName    = "MyTable",
                    Reference      = "A1:B10",
                    TotalsRowShown = false
                };
                var columns = new TableColumns
                {
                    Count = 2U
                };
                var column1 = new TableColumn
                {
                    Id   = 1U,
                    Name = "Column1"
                };
                var column2 = new TableColumn
                {
                    Id   = 2U,
                    Name = "Column2"
                };
                var styleInfo = new TableStyleInfo
                {
                    Name              = "TableStyleMedium2",
                    ShowFirstColumn   = false,
                    ShowLastColumn    = false,
                    ShowRowStripes    = true,
                    ShowColumnStripes = false
                };
                var autoFilter = new AutoFilter
                {
                    Reference = "A1:B10"
                };
                columns.Append(column1);
                columns.Append(column2);
                T.Append(autoFilter);
                T.Append(columns);
                T.Append(styleInfo);
                tdp.Table = T;
                T.Save( );

                var tableParts = new TableParts
                {
                    Count = 1U
                };
                var tablePart = new TablePart
                {
                    Id = rId
                };
                tableParts.Append(tablePart);
                newWorksheetPart.Worksheet.Append(tableParts);

                newWorksheetPart.Worksheet.Save( );


                // Create Styles and Insert into Workbook
                var        stylesPart = workbookPart.AddNewPart <WorkbookStylesPart>( );
                Stylesheet styles     = new ExportDataStylesheet( );
                styles.Save(stylesPart);

                // Insert Datatable data into the worksheet.
                InsertTableData(queryResult, sheetData, stylesPart);

                // Save the worksheet.
                newWorksheetPart.Worksheet.Save( );

                // Link this worksheet to our workbook
                spreadSheet.WorkbookPart.Workbook.GetFirstChild <Sheets>( ).AppendChild(new Sheet
                {
                    Id      = spreadSheet.WorkbookPart.GetIdOfPart(newWorksheetPart),
                    SheetId = 1,
                    Name    = "Table"
                });

                // Save the workbook.
                spreadSheet.WorkbookPart.Workbook.Save( );
            }
            return(ms);
        }
示例#18
0
        /// <summary>
        /// Generates the Content of the table in the worksheet
        /// </summary>
        /// <param name="worksheetPart">Worksheet to add the content onto</param>
        private void GenerateWorksheetContent(WorksheetPart worksheetPart)
        {
            var worksheet = new Worksheet {
                MCAttributes = new MarkupCompatibilityAttributes {
                    Ignorable = "x14ac xr xr2 xr3"
                }
            };

            worksheet.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            worksheet.AddNamespaceDeclaration("xr", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision");
            worksheet.AddNamespaceDeclaration("xr2", "http://schemas.microsoft.com/office/spreadsheetml/2015/revision2");
            worksheet.AddNamespaceDeclaration("xr3", "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3");
            worksheet.SetAttribute(new OpenXmlAttribute("xr", "uid", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision", "{AB762A7B-1BC4-4BEC-86BE-67D5F0445939}"));

            SheetData sheetData = new SheetData();

            Row header = new Row {
                RowIndex = 1U, Spans = new ListValue <StringValue> {
                    InnerText = "1:2"
                }, DyDescent = 0.4D
            };

            for (var i = 0; i < _tableColumns.Count; i++)
            {
                string column = ConvertToAlphabetBasedNumber(i + 1);

                Cell cell = new Cell {
                    CellReference = $"{column}1",
                    StyleIndex    = 1U, DataType = CellValues.String, CellValue = new CellValue(_tableColumns[i])
                };

                header.Append(cell);
            }

            sheetData.Append(header);

            for (var y = 0; y < _rows.Count; y++)
            {
                uint rowIndex = (uint)(y + 2); //1 based index plus the header
                Row  row      = new Row {
                    RowIndex = rowIndex, Spans = new ListValue <StringValue> {
                        InnerText = "1:2"
                    }, DyDescent = 0.4D
                };

                for (var x = 0; x < _rows[y].Count; x++)
                {
                    TableCell tableCell = _rows[y][x];

                    string column = ConvertToAlphabetBasedNumber(x + 1);

                    Cell cell = new Cell {
                        CellReference = $"{column}{rowIndex}",
                        StyleIndex    = 1U, DataType = tableCell.ValueType, CellValue = tableCell.GetValue()
                    };

                    row.Append(cell);
                }

                sheetData.Append(row);
            }

            TableParts tableParts = new TableParts {
                Count = 1U
            };
            TablePart tablePart = new TablePart {
                Id = "rId2"
            };

            tableParts.Append(tablePart);

            worksheet.Append(sheetData);
            worksheet.Append(tableParts);

            worksheetPart.Worksheet = worksheet;
        }
示例#19
0
        /// <summary>
        /// Gets the table parts used to render a specific table row.
        /// </summary>
        /// <param name="part">The table part.</param>
        /// <returns>The table parts used to render the specific table row.</returns>
        protected (string Left, string Center, string Separator, string Right) GetTableParts(TablePart part)
        {
            return(part switch
            {
                // Top part
                TablePart.Top =>
                (GetPart(TableBorderPart.HeaderTopLeft), GetPart(TableBorderPart.HeaderTop),
                 GetPart(TableBorderPart.HeaderTopSeparator), GetPart(TableBorderPart.HeaderTopRight)),

                // Separator between header and cells
                TablePart.HeaderSeparator =>
                (GetPart(TableBorderPart.HeaderBottomLeft), GetPart(TableBorderPart.HeaderBottom),
                 GetPart(TableBorderPart.HeaderBottomSeparator), GetPart(TableBorderPart.HeaderBottomRight)),

                // Separator between footer and cells
                TablePart.FooterSeparator =>
                (GetPart(TableBorderPart.FooterTopLeft), GetPart(TableBorderPart.FooterTop),
                 GetPart(TableBorderPart.FooterTopSeparator), GetPart(TableBorderPart.FooterTopRight)),

                // Bottom part
                TablePart.Bottom =>
                (GetPart(TableBorderPart.FooterBottomLeft), GetPart(TableBorderPart.FooterBottom),
                 GetPart(TableBorderPart.FooterBottomSeparator), GetPart(TableBorderPart.FooterBottomRight)),

                // Unknown
                _ => throw new NotSupportedException("Unknown column row part"),
            });
        // Generates content of worksheetPart1.
        private void GenerateWorksheetPart1Content(WorksheetPart worksheetPart1)
        {
            Worksheet worksheet1 = new Worksheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" }  };
            worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            worksheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            worksheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            SheetProperties sheetProperties1 = new SheetProperties(){ CodeName = "Sheet1" };
            SheetDimension sheetDimension1 = new SheetDimension(){ Reference = "B2:I41" };

            SheetViews sheetViews1 = new SheetViews();

            SheetView sheetView1 = new SheetView(){ TabSelected = true, WorkbookViewId = (UInt32Value)0U };
            Selection selection1 = new Selection(){ ActiveCell = "G18", SequenceOfReferences = new ListValue<StringValue>() { InnerText = "G18" } };

            sheetView1.Append(selection1);

            sheetViews1.Append(sheetView1);
            SheetFormatProperties sheetFormatProperties1 = new SheetFormatProperties(){ DefaultRowHeight = 15D };

            Columns columns1 = new Columns();
            Column column1 = new Column(){ Min = (UInt32Value)2U, Max = (UInt32Value)2U, Width = 12.85546875D, BestFit = true, CustomWidth = true };
            Column column2 = new Column(){ Min = (UInt32Value)3U, Max = (UInt32Value)3U, Width = 17.140625D, BestFit = true, CustomWidth = true };
            Column column3 = new Column(){ Min = (UInt32Value)4U, Max = (UInt32Value)4U, Width = 24D, BestFit = true, CustomWidth = true };
            Column column4 = new Column(){ Min = (UInt32Value)5U, Max = (UInt32Value)5U, Width = 15.140625D, BestFit = true, CustomWidth = true };
            Column column5 = new Column(){ Min = (UInt32Value)6U, Max = (UInt32Value)6U, Width = 16.5703125D, BestFit = true, CustomWidth = true };
            Column column6 = new Column(){ Min = (UInt32Value)7U, Max = (UInt32Value)7U, Width = 81.140625D, BestFit = true, CustomWidth = true };
            Column column7 = new Column(){ Min = (UInt32Value)8U, Max = (UInt32Value)8U, Width = 18.7109375D, BestFit = true, CustomWidth = true };
            Column column8 = new Column(){ Min = (UInt32Value)9U, Max = (UInt32Value)9U, Width = 14.5703125D, BestFit = true, CustomWidth = true };

            columns1.Append(column1);
            columns1.Append(column2);
            columns1.Append(column3);
            columns1.Append(column4);
            columns1.Append(column5);
            columns1.Append(column6);
            columns1.Append(column7);
            columns1.Append(column8);

            SheetData sheetData1 = new SheetData();

            Row row1 = new Row(){ RowIndex = (UInt32Value)2U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell1 = new Cell(){ CellReference = "B2", DataType = CellValues.SharedString };
            CellValue cellValue1 = new CellValue();
            cellValue1.Text = "0";

            cell1.Append(cellValue1);

            Cell cell2 = new Cell(){ CellReference = "C2", DataType = CellValues.SharedString };
            CellValue cellValue2 = new CellValue();
            cellValue2.Text = "1";

            cell2.Append(cellValue2);

            Cell cell3 = new Cell(){ CellReference = "D2", DataType = CellValues.SharedString };
            CellValue cellValue3 = new CellValue();
            cellValue3.Text = "2";

            cell3.Append(cellValue3);

            Cell cell4 = new Cell(){ CellReference = "E2", DataType = CellValues.SharedString };
            CellValue cellValue4 = new CellValue();
            cellValue4.Text = "3";

            cell4.Append(cellValue4);

            Cell cell5 = new Cell(){ CellReference = "F2", DataType = CellValues.SharedString };
            CellValue cellValue5 = new CellValue();
            cellValue5.Text = "4";

            cell5.Append(cellValue5);

            Cell cell6 = new Cell(){ CellReference = "G2", DataType = CellValues.SharedString };
            CellValue cellValue6 = new CellValue();
            cellValue6.Text = "5";

            cell6.Append(cellValue6);

            Cell cell7 = new Cell(){ CellReference = "H2", DataType = CellValues.SharedString };
            CellValue cellValue7 = new CellValue();
            cellValue7.Text = "6";

            cell7.Append(cellValue7);

            Cell cell8 = new Cell(){ CellReference = "I2", DataType = CellValues.SharedString };
            CellValue cellValue8 = new CellValue();
            cellValue8.Text = "7";

            cell8.Append(cellValue8);

            row1.Append(cell1);
            row1.Append(cell2);
            row1.Append(cell3);
            row1.Append(cell4);
            row1.Append(cell5);
            row1.Append(cell6);
            row1.Append(cell7);
            row1.Append(cell8);

            Row row2 = new Row(){ RowIndex = (UInt32Value)3U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell9 = new Cell(){ CellReference = "B3" };
            CellValue cellValue9 = new CellValue();
            cellValue9.Text = "4000";

            cell9.Append(cellValue9);

            Cell cell10 = new Cell(){ CellReference = "C3" };
            CellValue cellValue10 = new CellValue();
            cellValue10.Text = "5000";

            cell10.Append(cellValue10);

            Cell cell11 = new Cell(){ CellReference = "D3", DataType = CellValues.SharedString };
            CellValue cellValue11 = new CellValue();
            cellValue11.Text = "8";

            cell11.Append(cellValue11);

            Cell cell12 = new Cell(){ CellReference = "E3", DataType = CellValues.SharedString };
            CellValue cellValue12 = new CellValue();
            cellValue12.Text = "9";

            cell12.Append(cellValue12);

            Cell cell13 = new Cell(){ CellReference = "F3", DataType = CellValues.SharedString };
            CellValue cellValue13 = new CellValue();
            cellValue13.Text = "10";

            cell13.Append(cellValue13);

            Cell cell14 = new Cell(){ CellReference = "H3", DataType = CellValues.SharedString };
            CellValue cellValue14 = new CellValue();
            cellValue14.Text = "11";

            cell14.Append(cellValue14);

            Cell cell15 = new Cell(){ CellReference = "I3", StyleIndex = (UInt32Value)1U };
            CellValue cellValue15 = new CellValue();
            cellValue15.Text = "40855.491680594139";

            cell15.Append(cellValue15);

            row2.Append(cell9);
            row2.Append(cell10);
            row2.Append(cell11);
            row2.Append(cell12);
            row2.Append(cell13);
            row2.Append(cell14);
            row2.Append(cell15);

            Row row3 = new Row(){ RowIndex = (UInt32Value)4U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell16 = new Cell(){ CellReference = "B4" };
            CellValue cellValue16 = new CellValue();
            cellValue16.Text = "2000";

            cell16.Append(cellValue16);

            Cell cell17 = new Cell(){ CellReference = "D4", DataType = CellValues.SharedString };
            CellValue cellValue17 = new CellValue();
            cellValue17.Text = "12";

            cell17.Append(cellValue17);

            Cell cell18 = new Cell(){ CellReference = "E4", DataType = CellValues.SharedString };
            CellValue cellValue18 = new CellValue();
            cellValue18.Text = "13";

            cell18.Append(cellValue18);

            Cell cell19 = new Cell(){ CellReference = "F4", DataType = CellValues.SharedString };
            CellValue cellValue19 = new CellValue();
            cellValue19.Text = "14";

            cell19.Append(cellValue19);

            Cell cell20 = new Cell(){ CellReference = "H4", DataType = CellValues.SharedString };
            CellValue cellValue20 = new CellValue();
            cellValue20.Text = "11";

            cell20.Append(cellValue20);

            Cell cell21 = new Cell(){ CellReference = "I4", StyleIndex = (UInt32Value)1U };
            CellValue cellValue21 = new CellValue();
            cellValue21.Text = "40855.491680594139";

            cell21.Append(cellValue21);

            row3.Append(cell16);
            row3.Append(cell17);
            row3.Append(cell18);
            row3.Append(cell19);
            row3.Append(cell20);
            row3.Append(cell21);

            Row row4 = new Row(){ RowIndex = (UInt32Value)5U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell22 = new Cell(){ CellReference = "B5" };
            CellValue cellValue22 = new CellValue();
            cellValue22.Text = "4300";

            cell22.Append(cellValue22);

            Cell cell23 = new Cell(){ CellReference = "C5" };
            CellValue cellValue23 = new CellValue();
            cellValue23.Text = "4000";

            cell23.Append(cellValue23);

            Cell cell24 = new Cell(){ CellReference = "D5", DataType = CellValues.SharedString };
            CellValue cellValue24 = new CellValue();
            cellValue24.Text = "15";

            cell24.Append(cellValue24);

            Cell cell25 = new Cell(){ CellReference = "E5", DataType = CellValues.SharedString };
            CellValue cellValue25 = new CellValue();
            cellValue25.Text = "9";

            cell25.Append(cellValue25);

            Cell cell26 = new Cell(){ CellReference = "F5", DataType = CellValues.SharedString };
            CellValue cellValue26 = new CellValue();
            cellValue26.Text = "16";

            cell26.Append(cellValue26);

            Cell cell27 = new Cell(){ CellReference = "H5", DataType = CellValues.SharedString };
            CellValue cellValue27 = new CellValue();
            cellValue27.Text = "11";

            cell27.Append(cellValue27);

            Cell cell28 = new Cell(){ CellReference = "I5", StyleIndex = (UInt32Value)1U };
            CellValue cellValue28 = new CellValue();
            cellValue28.Text = "40855.491680594139";

            cell28.Append(cellValue28);

            row4.Append(cell22);
            row4.Append(cell23);
            row4.Append(cell24);
            row4.Append(cell25);
            row4.Append(cell26);
            row4.Append(cell27);
            row4.Append(cell28);

            Row row5 = new Row(){ RowIndex = (UInt32Value)6U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell29 = new Cell(){ CellReference = "B6" };
            CellValue cellValue29 = new CellValue();
            cellValue29.Text = "3200";

            cell29.Append(cellValue29);

            Cell cell30 = new Cell(){ CellReference = "C6" };
            CellValue cellValue30 = new CellValue();
            cellValue30.Text = "3000";

            cell30.Append(cellValue30);

            Cell cell31 = new Cell(){ CellReference = "D6", DataType = CellValues.SharedString };
            CellValue cellValue31 = new CellValue();
            cellValue31.Text = "17";

            cell31.Append(cellValue31);

            Cell cell32 = new Cell(){ CellReference = "E6", DataType = CellValues.SharedString };
            CellValue cellValue32 = new CellValue();
            cellValue32.Text = "18";

            cell32.Append(cellValue32);

            Cell cell33 = new Cell(){ CellReference = "F6", DataType = CellValues.SharedString };
            CellValue cellValue33 = new CellValue();
            cellValue33.Text = "10";

            cell33.Append(cellValue33);

            Cell cell34 = new Cell(){ CellReference = "H6", DataType = CellValues.SharedString };
            CellValue cellValue34 = new CellValue();
            cellValue34.Text = "11";

            cell34.Append(cellValue34);

            Cell cell35 = new Cell(){ CellReference = "I6", StyleIndex = (UInt32Value)1U };
            CellValue cellValue35 = new CellValue();
            cellValue35.Text = "40855.491680594139";

            cell35.Append(cellValue35);

            row5.Append(cell29);
            row5.Append(cell30);
            row5.Append(cell31);
            row5.Append(cell32);
            row5.Append(cell33);
            row5.Append(cell34);
            row5.Append(cell35);

            Row row6 = new Row(){ RowIndex = (UInt32Value)7U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell36 = new Cell(){ CellReference = "B7" };
            CellValue cellValue36 = new CellValue();
            cellValue36.Text = "4100";

            cell36.Append(cellValue36);

            Cell cell37 = new Cell(){ CellReference = "C7" };
            CellValue cellValue37 = new CellValue();
            cellValue37.Text = "4000";

            cell37.Append(cellValue37);

            Cell cell38 = new Cell(){ CellReference = "D7", DataType = CellValues.SharedString };
            CellValue cellValue38 = new CellValue();
            cellValue38.Text = "19";

            cell38.Append(cellValue38);

            Cell cell39 = new Cell(){ CellReference = "E7", DataType = CellValues.SharedString };
            CellValue cellValue39 = new CellValue();
            cellValue39.Text = "9";

            cell39.Append(cellValue39);

            Cell cell40 = new Cell(){ CellReference = "F7", DataType = CellValues.SharedString };
            CellValue cellValue40 = new CellValue();
            cellValue40.Text = "16";

            cell40.Append(cellValue40);

            Cell cell41 = new Cell(){ CellReference = "H7", DataType = CellValues.SharedString };
            CellValue cellValue41 = new CellValue();
            cellValue41.Text = "11";

            cell41.Append(cellValue41);

            Cell cell42 = new Cell(){ CellReference = "I7", StyleIndex = (UInt32Value)1U };
            CellValue cellValue42 = new CellValue();
            cellValue42.Text = "40855.491680594139";

            cell42.Append(cellValue42);

            row6.Append(cell36);
            row6.Append(cell37);
            row6.Append(cell38);
            row6.Append(cell39);
            row6.Append(cell40);
            row6.Append(cell41);
            row6.Append(cell42);

            Row row7 = new Row(){ RowIndex = (UInt32Value)8U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell43 = new Cell(){ CellReference = "B8" };
            CellValue cellValue43 = new CellValue();
            cellValue43.Text = "4400";

            cell43.Append(cellValue43);

            Cell cell44 = new Cell(){ CellReference = "C8" };
            CellValue cellValue44 = new CellValue();
            cellValue44.Text = "4000";

            cell44.Append(cellValue44);

            Cell cell45 = new Cell(){ CellReference = "D8", DataType = CellValues.SharedString };
            CellValue cellValue45 = new CellValue();
            cellValue45.Text = "20";

            cell45.Append(cellValue45);

            Cell cell46 = new Cell(){ CellReference = "E8", DataType = CellValues.SharedString };
            CellValue cellValue46 = new CellValue();
            cellValue46.Text = "9";

            cell46.Append(cellValue46);

            Cell cell47 = new Cell(){ CellReference = "F8", DataType = CellValues.SharedString };
            CellValue cellValue47 = new CellValue();
            cellValue47.Text = "16";

            cell47.Append(cellValue47);

            Cell cell48 = new Cell(){ CellReference = "H8", DataType = CellValues.SharedString };
            CellValue cellValue48 = new CellValue();
            cellValue48.Text = "11";

            cell48.Append(cellValue48);

            Cell cell49 = new Cell(){ CellReference = "I8", StyleIndex = (UInt32Value)1U };
            CellValue cellValue49 = new CellValue();
            cellValue49.Text = "40855.491680594139";

            cell49.Append(cellValue49);

            row7.Append(cell43);
            row7.Append(cell44);
            row7.Append(cell45);
            row7.Append(cell46);
            row7.Append(cell47);
            row7.Append(cell48);
            row7.Append(cell49);

            Row row8 = new Row(){ RowIndex = (UInt32Value)9U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell50 = new Cell(){ CellReference = "B9" };
            CellValue cellValue50 = new CellValue();
            cellValue50.Text = "3100";

            cell50.Append(cellValue50);

            Cell cell51 = new Cell(){ CellReference = "C9" };
            CellValue cellValue51 = new CellValue();
            cellValue51.Text = "3000";

            cell51.Append(cellValue51);

            Cell cell52 = new Cell(){ CellReference = "D9", DataType = CellValues.SharedString };
            CellValue cellValue52 = new CellValue();
            cellValue52.Text = "21";

            cell52.Append(cellValue52);

            Cell cell53 = new Cell(){ CellReference = "E9", DataType = CellValues.SharedString };
            CellValue cellValue53 = new CellValue();
            cellValue53.Text = "18";

            cell53.Append(cellValue53);

            Cell cell54 = new Cell(){ CellReference = "F9", DataType = CellValues.SharedString };
            CellValue cellValue54 = new CellValue();
            cellValue54.Text = "16";

            cell54.Append(cellValue54);

            Cell cell55 = new Cell(){ CellReference = "G9", DataType = CellValues.SharedString };
            CellValue cellValue55 = new CellValue();
            cellValue55.Text = "22";

            cell55.Append(cellValue55);

            Cell cell56 = new Cell(){ CellReference = "H9", DataType = CellValues.SharedString };
            CellValue cellValue56 = new CellValue();
            cellValue56.Text = "11";

            cell56.Append(cellValue56);

            Cell cell57 = new Cell(){ CellReference = "I9", StyleIndex = (UInt32Value)1U };
            CellValue cellValue57 = new CellValue();
            cellValue57.Text = "40855.491680594139";

            cell57.Append(cellValue57);

            row8.Append(cell50);
            row8.Append(cell51);
            row8.Append(cell52);
            row8.Append(cell53);
            row8.Append(cell54);
            row8.Append(cell55);
            row8.Append(cell56);
            row8.Append(cell57);

            Row row9 = new Row(){ RowIndex = (UInt32Value)10U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell58 = new Cell(){ CellReference = "B10" };
            CellValue cellValue58 = new CellValue();
            cellValue58.Text = "3000";

            cell58.Append(cellValue58);

            Cell cell59 = new Cell(){ CellReference = "C10" };
            CellValue cellValue59 = new CellValue();
            cellValue59.Text = "5000";

            cell59.Append(cellValue59);

            Cell cell60 = new Cell(){ CellReference = "D10", DataType = CellValues.SharedString };
            CellValue cellValue60 = new CellValue();
            cellValue60.Text = "23";

            cell60.Append(cellValue60);

            Cell cell61 = new Cell(){ CellReference = "E10", DataType = CellValues.SharedString };
            CellValue cellValue61 = new CellValue();
            cellValue61.Text = "18";

            cell61.Append(cellValue61);

            Cell cell62 = new Cell(){ CellReference = "F10", DataType = CellValues.SharedString };
            CellValue cellValue62 = new CellValue();
            cellValue62.Text = "16";

            cell62.Append(cellValue62);

            Cell cell63 = new Cell(){ CellReference = "H10", DataType = CellValues.SharedString };
            CellValue cellValue63 = new CellValue();
            cellValue63.Text = "11";

            cell63.Append(cellValue63);

            Cell cell64 = new Cell(){ CellReference = "I10", StyleIndex = (UInt32Value)1U };
            CellValue cellValue64 = new CellValue();
            cellValue64.Text = "40855.491680594139";

            cell64.Append(cellValue64);

            row9.Append(cell58);
            row9.Append(cell59);
            row9.Append(cell60);
            row9.Append(cell61);
            row9.Append(cell62);
            row9.Append(cell63);
            row9.Append(cell64);

            Row row10 = new Row(){ RowIndex = (UInt32Value)11U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell65 = new Cell(){ CellReference = "B11" };
            CellValue cellValue65 = new CellValue();
            cellValue65.Text = "5000";

            cell65.Append(cellValue65);

            Cell cell66 = new Cell(){ CellReference = "D11", DataType = CellValues.SharedString };
            CellValue cellValue66 = new CellValue();
            cellValue66.Text = "24";

            cell66.Append(cellValue66);

            Cell cell67 = new Cell(){ CellReference = "E11", DataType = CellValues.SharedString };
            CellValue cellValue67 = new CellValue();
            cellValue67.Text = "18";

            cell67.Append(cellValue67);

            Cell cell68 = new Cell(){ CellReference = "F11", DataType = CellValues.SharedString };
            CellValue cellValue68 = new CellValue();
            cellValue68.Text = "16";

            cell68.Append(cellValue68);

            Cell cell69 = new Cell(){ CellReference = "H11", DataType = CellValues.SharedString };
            CellValue cellValue69 = new CellValue();
            cellValue69.Text = "11";

            cell69.Append(cellValue69);

            Cell cell70 = new Cell(){ CellReference = "I11", StyleIndex = (UInt32Value)1U };
            CellValue cellValue70 = new CellValue();
            cellValue70.Text = "40855.491680594139";

            cell70.Append(cellValue70);

            row10.Append(cell65);
            row10.Append(cell66);
            row10.Append(cell67);
            row10.Append(cell68);
            row10.Append(cell69);
            row10.Append(cell70);

            Row row11 = new Row(){ RowIndex = (UInt32Value)12U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell71 = new Cell(){ CellReference = "B12" };
            CellValue cellValue71 = new CellValue();
            cellValue71.Text = "4200";

            cell71.Append(cellValue71);

            Cell cell72 = new Cell(){ CellReference = "C12" };
            CellValue cellValue72 = new CellValue();
            cellValue72.Text = "4000";

            cell72.Append(cellValue72);

            Cell cell73 = new Cell(){ CellReference = "D12", DataType = CellValues.SharedString };
            CellValue cellValue73 = new CellValue();
            cellValue73.Text = "25";

            cell73.Append(cellValue73);

            Cell cell74 = new Cell(){ CellReference = "E12", DataType = CellValues.SharedString };
            CellValue cellValue74 = new CellValue();
            cellValue74.Text = "9";

            cell74.Append(cellValue74);

            Cell cell75 = new Cell(){ CellReference = "F12", DataType = CellValues.SharedString };
            CellValue cellValue75 = new CellValue();
            cellValue75.Text = "16";

            cell75.Append(cellValue75);

            Cell cell76 = new Cell(){ CellReference = "H12", DataType = CellValues.SharedString };
            CellValue cellValue76 = new CellValue();
            cellValue76.Text = "11";

            cell76.Append(cellValue76);

            Cell cell77 = new Cell(){ CellReference = "I12", StyleIndex = (UInt32Value)1U };
            CellValue cellValue77 = new CellValue();
            cellValue77.Text = "40855.491680594139";

            cell77.Append(cellValue77);

            row11.Append(cell71);
            row11.Append(cell72);
            row11.Append(cell73);
            row11.Append(cell74);
            row11.Append(cell75);
            row11.Append(cell76);
            row11.Append(cell77);

            Row row12 = new Row(){ RowIndex = (UInt32Value)13U, Spans = new ListValue<StringValue>() { InnerText = "2:9" } };

            Cell cell78 = new Cell(){ CellReference = "B13" };
            CellValue cellValue78 = new CellValue();
            cellValue78.Text = "1000";

            cell78.Append(cellValue78);

            Cell cell79 = new Cell(){ CellReference = "D13", DataType = CellValues.SharedString };
            CellValue cellValue79 = new CellValue();
            cellValue79.Text = "26";

            cell79.Append(cellValue79);

            Cell cell80 = new Cell(){ CellReference = "E13", DataType = CellValues.SharedString };
            CellValue cellValue80 = new CellValue();
            cellValue80.Text = "27";

            cell80.Append(cellValue80);

            Cell cell81 = new Cell(){ CellReference = "F13", DataType = CellValues.SharedString };
            CellValue cellValue81 = new CellValue();
            cellValue81.Text = "14";

            cell81.Append(cellValue81);

            Cell cell82 = new Cell(){ CellReference = "H13", DataType = CellValues.SharedString };
            CellValue cellValue82 = new CellValue();
            cellValue82.Text = "11";

            cell82.Append(cellValue82);

            Cell cell83 = new Cell(){ CellReference = "I13", StyleIndex = (UInt32Value)1U };
            CellValue cellValue83 = new CellValue();
            cellValue83.Text = "40855.491680594139";

            cell83.Append(cellValue83);

            row12.Append(cell78);
            row12.Append(cell79);
            row12.Append(cell80);
            row12.Append(cell81);
            row12.Append(cell82);
            row12.Append(cell83);

            Row row13 = new Row(){ RowIndex = (UInt32Value)24U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell84 = new Cell(){ CellReference = "C24", StyleIndex = (UInt32Value)2U };
            Cell cell85 = new Cell(){ CellReference = "D24", StyleIndex = (UInt32Value)3U };
            Cell cell86 = new Cell(){ CellReference = "E24", StyleIndex = (UInt32Value)4U };

            row13.Append(cell84);
            row13.Append(cell85);
            row13.Append(cell86);

            Row row14 = new Row(){ RowIndex = (UInt32Value)25U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell87 = new Cell(){ CellReference = "C25", StyleIndex = (UInt32Value)5U };
            Cell cell88 = new Cell(){ CellReference = "D25", StyleIndex = (UInt32Value)6U };
            Cell cell89 = new Cell(){ CellReference = "E25", StyleIndex = (UInt32Value)7U };

            row14.Append(cell87);
            row14.Append(cell88);
            row14.Append(cell89);

            Row row15 = new Row(){ RowIndex = (UInt32Value)26U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell90 = new Cell(){ CellReference = "C26", StyleIndex = (UInt32Value)5U };
            Cell cell91 = new Cell(){ CellReference = "D26", StyleIndex = (UInt32Value)6U };
            Cell cell92 = new Cell(){ CellReference = "E26", StyleIndex = (UInt32Value)7U };

            row15.Append(cell90);
            row15.Append(cell91);
            row15.Append(cell92);

            Row row16 = new Row(){ RowIndex = (UInt32Value)27U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell93 = new Cell(){ CellReference = "C27", StyleIndex = (UInt32Value)5U };
            Cell cell94 = new Cell(){ CellReference = "D27", StyleIndex = (UInt32Value)6U };
            Cell cell95 = new Cell(){ CellReference = "E27", StyleIndex = (UInt32Value)7U };

            row16.Append(cell93);
            row16.Append(cell94);
            row16.Append(cell95);

            Row row17 = new Row(){ RowIndex = (UInt32Value)28U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell96 = new Cell(){ CellReference = "C28", StyleIndex = (UInt32Value)5U };
            Cell cell97 = new Cell(){ CellReference = "D28", StyleIndex = (UInt32Value)6U };
            Cell cell98 = new Cell(){ CellReference = "E28", StyleIndex = (UInt32Value)7U };

            row17.Append(cell96);
            row17.Append(cell97);
            row17.Append(cell98);

            Row row18 = new Row(){ RowIndex = (UInt32Value)29U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell99 = new Cell(){ CellReference = "C29", StyleIndex = (UInt32Value)5U };
            Cell cell100 = new Cell(){ CellReference = "D29", StyleIndex = (UInt32Value)6U };
            Cell cell101 = new Cell(){ CellReference = "E29", StyleIndex = (UInt32Value)7U };

            row18.Append(cell99);
            row18.Append(cell100);
            row18.Append(cell101);

            Row row19 = new Row(){ RowIndex = (UInt32Value)30U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell102 = new Cell(){ CellReference = "C30", StyleIndex = (UInt32Value)5U };
            Cell cell103 = new Cell(){ CellReference = "D30", StyleIndex = (UInt32Value)6U };
            Cell cell104 = new Cell(){ CellReference = "E30", StyleIndex = (UInt32Value)7U };

            row19.Append(cell102);
            row19.Append(cell103);
            row19.Append(cell104);

            Row row20 = new Row(){ RowIndex = (UInt32Value)31U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell105 = new Cell(){ CellReference = "C31", StyleIndex = (UInt32Value)5U };
            Cell cell106 = new Cell(){ CellReference = "D31", StyleIndex = (UInt32Value)6U };
            Cell cell107 = new Cell(){ CellReference = "E31", StyleIndex = (UInt32Value)7U };

            row20.Append(cell105);
            row20.Append(cell106);
            row20.Append(cell107);

            Row row21 = new Row(){ RowIndex = (UInt32Value)32U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell108 = new Cell(){ CellReference = "C32", StyleIndex = (UInt32Value)5U };
            Cell cell109 = new Cell(){ CellReference = "D32", StyleIndex = (UInt32Value)6U };
            Cell cell110 = new Cell(){ CellReference = "E32", StyleIndex = (UInt32Value)7U };

            row21.Append(cell108);
            row21.Append(cell109);
            row21.Append(cell110);

            Row row22 = new Row(){ RowIndex = (UInt32Value)33U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell111 = new Cell(){ CellReference = "C33", StyleIndex = (UInt32Value)5U };
            Cell cell112 = new Cell(){ CellReference = "D33", StyleIndex = (UInt32Value)6U };
            Cell cell113 = new Cell(){ CellReference = "E33", StyleIndex = (UInt32Value)7U };

            row22.Append(cell111);
            row22.Append(cell112);
            row22.Append(cell113);

            Row row23 = new Row(){ RowIndex = (UInt32Value)34U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell114 = new Cell(){ CellReference = "C34", StyleIndex = (UInt32Value)5U };
            Cell cell115 = new Cell(){ CellReference = "D34", StyleIndex = (UInt32Value)6U };
            Cell cell116 = new Cell(){ CellReference = "E34", StyleIndex = (UInt32Value)7U };

            row23.Append(cell114);
            row23.Append(cell115);
            row23.Append(cell116);

            Row row24 = new Row(){ RowIndex = (UInt32Value)35U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell117 = new Cell(){ CellReference = "C35", StyleIndex = (UInt32Value)5U };
            Cell cell118 = new Cell(){ CellReference = "D35", StyleIndex = (UInt32Value)6U };
            Cell cell119 = new Cell(){ CellReference = "E35", StyleIndex = (UInt32Value)7U };

            row24.Append(cell117);
            row24.Append(cell118);
            row24.Append(cell119);

            Row row25 = new Row(){ RowIndex = (UInt32Value)36U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell120 = new Cell(){ CellReference = "C36", StyleIndex = (UInt32Value)5U };
            Cell cell121 = new Cell(){ CellReference = "D36", StyleIndex = (UInt32Value)6U };
            Cell cell122 = new Cell(){ CellReference = "E36", StyleIndex = (UInt32Value)7U };

            row25.Append(cell120);
            row25.Append(cell121);
            row25.Append(cell122);

            Row row26 = new Row(){ RowIndex = (UInt32Value)37U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell123 = new Cell(){ CellReference = "C37", StyleIndex = (UInt32Value)5U };
            Cell cell124 = new Cell(){ CellReference = "D37", StyleIndex = (UInt32Value)6U };
            Cell cell125 = new Cell(){ CellReference = "E37", StyleIndex = (UInt32Value)7U };

            row26.Append(cell123);
            row26.Append(cell124);
            row26.Append(cell125);

            Row row27 = new Row(){ RowIndex = (UInt32Value)38U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell126 = new Cell(){ CellReference = "C38", StyleIndex = (UInt32Value)5U };
            Cell cell127 = new Cell(){ CellReference = "D38", StyleIndex = (UInt32Value)6U };
            Cell cell128 = new Cell(){ CellReference = "E38", StyleIndex = (UInt32Value)7U };

            row27.Append(cell126);
            row27.Append(cell127);
            row27.Append(cell128);

            Row row28 = new Row(){ RowIndex = (UInt32Value)39U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell129 = new Cell(){ CellReference = "C39", StyleIndex = (UInt32Value)5U };
            Cell cell130 = new Cell(){ CellReference = "D39", StyleIndex = (UInt32Value)6U };
            Cell cell131 = new Cell(){ CellReference = "E39", StyleIndex = (UInt32Value)7U };

            row28.Append(cell129);
            row28.Append(cell130);
            row28.Append(cell131);

            Row row29 = new Row(){ RowIndex = (UInt32Value)40U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell132 = new Cell(){ CellReference = "C40", StyleIndex = (UInt32Value)5U };
            Cell cell133 = new Cell(){ CellReference = "D40", StyleIndex = (UInt32Value)6U };
            Cell cell134 = new Cell(){ CellReference = "E40", StyleIndex = (UInt32Value)7U };

            row29.Append(cell132);
            row29.Append(cell133);
            row29.Append(cell134);

            Row row30 = new Row(){ RowIndex = (UInt32Value)41U, Spans = new ListValue<StringValue>() { InnerText = "3:5" } };
            Cell cell135 = new Cell(){ CellReference = "C41", StyleIndex = (UInt32Value)8U };
            Cell cell136 = new Cell(){ CellReference = "D41", StyleIndex = (UInt32Value)9U };
            Cell cell137 = new Cell(){ CellReference = "E41", StyleIndex = (UInt32Value)10U };

            row30.Append(cell135);
            row30.Append(cell136);
            row30.Append(cell137);

            sheetData1.Append(row1);
            sheetData1.Append(row2);
            sheetData1.Append(row3);
            sheetData1.Append(row4);
            sheetData1.Append(row5);
            sheetData1.Append(row6);
            sheetData1.Append(row7);
            sheetData1.Append(row8);
            sheetData1.Append(row9);
            sheetData1.Append(row10);
            sheetData1.Append(row11);
            sheetData1.Append(row12);
            sheetData1.Append(row13);
            sheetData1.Append(row14);
            sheetData1.Append(row15);
            sheetData1.Append(row16);
            sheetData1.Append(row17);
            sheetData1.Append(row18);
            sheetData1.Append(row19);
            sheetData1.Append(row20);
            sheetData1.Append(row21);
            sheetData1.Append(row22);
            sheetData1.Append(row23);
            sheetData1.Append(row24);
            sheetData1.Append(row25);
            sheetData1.Append(row26);
            sheetData1.Append(row27);
            sheetData1.Append(row28);
            sheetData1.Append(row29);
            sheetData1.Append(row30);
            PhoneticProperties phoneticProperties1 = new PhoneticProperties(){ FontId = (UInt32Value)1U };
            PageMargins pageMargins1 = new PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            PageSetup pageSetup1 = new PageSetup(){ PaperSize = (UInt32Value)9U, Orientation = OrientationValues.Portrait, Id = "rId2" };

            TableParts tableParts1 = new TableParts(){ Count = (UInt32Value)1U };
            TablePart tablePart1 = new TablePart(){ Id = "rId3" };

            tableParts1.Append(tablePart1);

            worksheet1.Append(sheetProperties1);
            worksheet1.Append(sheetDimension1);
            worksheet1.Append(sheetViews1);
            worksheet1.Append(sheetFormatProperties1);
            worksheet1.Append(columns1);
            worksheet1.Append(sheetData1);
            worksheet1.Append(phoneticProperties1);
            worksheet1.Append(pageMargins1);
            worksheet1.Append(pageSetup1);
            worksheet1.Append(tableParts1);

            worksheetPart1.Worksheet = worksheet1;
        }
示例#21
0
        // Generates content of worksheetPart4.
        private void GenerateWorksheetPart4Content(WorksheetPart worksheetPart4)
        {
            Worksheet worksheet4 = new Worksheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" }  };
            worksheet4.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            worksheet4.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            worksheet4.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            SheetDimension sheetDimension4 = new SheetDimension(){ Reference = "A1:K11" };

            SheetViews sheetViews4 = new SheetViews();
            SheetView sheetView4 = new SheetView(){ WorkbookViewId = (UInt32Value)0U };

            sheetViews4.Append(sheetView4);
            SheetFormatProperties sheetFormatProperties4 = new SheetFormatProperties(){ DefaultRowHeight = 15D };

            Columns columns4 = new Columns();
            Column column16 = new Column(){ Min = (UInt32Value)1U, Max = (UInt32Value)1U, Width = 10.7109375D, BestFit = true, CustomWidth = true };
            Column column17 = new Column(){ Min = (UInt32Value)2U, Max = (UInt32Value)2U, Width = 10.140625D, BestFit = true, CustomWidth = true };
            Column column18 = new Column(){ Min = (UInt32Value)3U, Max = (UInt32Value)3U, Width = 8.140625D, BestFit = true, CustomWidth = true };
            Column column19 = new Column(){ Min = (UInt32Value)4U, Max = (UInt32Value)4U, Width = 10.42578125D, BestFit = true, CustomWidth = true };
            Column column20 = new Column(){ Min = (UInt32Value)5U, Max = (UInt32Value)5U, Width = 12.85546875D, BestFit = true, CustomWidth = true };
            Column column21 = new Column(){ Min = (UInt32Value)6U, Max = (UInt32Value)6U, Width = 11.5703125D, BestFit = true, CustomWidth = true };
            Column column22 = new Column(){ Min = (UInt32Value)8U, Max = (UInt32Value)8U, Width = 12.85546875D, BestFit = true, CustomWidth = true };
            Column column23 = new Column(){ Min = (UInt32Value)9U, Max = (UInt32Value)9U, Width = 10.42578125D, BestFit = true, CustomWidth = true };
            Column column24 = new Column(){ Min = (UInt32Value)11U, Max = (UInt32Value)11U, Width = 12.85546875D, BestFit = true, CustomWidth = true };

            columns4.Append(column16);
            columns4.Append(column17);
            columns4.Append(column18);
            columns4.Append(column19);
            columns4.Append(column20);
            columns4.Append(column21);
            columns4.Append(column22);
            columns4.Append(column23);
            columns4.Append(column24);

            SheetData sheetData4 = new SheetData();

            Row row16 = new Row(){ RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell31 = new Cell(){ CellReference = "A1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue31 = new CellValue();
            cellValue31.Text = "0";

            cell31.Append(cellValue31);

            Cell cell32 = new Cell(){ CellReference = "B1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue32 = new CellValue();
            cellValue32.Text = "1";

            cell32.Append(cellValue32);

            Cell cell33 = new Cell(){ CellReference = "C1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue33 = new CellValue();
            cellValue33.Text = "2";

            cell33.Append(cellValue33);

            Cell cell34 = new Cell(){ CellReference = "D1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue34 = new CellValue();
            cellValue34.Text = "3";

            cell34.Append(cellValue34);

            Cell cell35 = new Cell(){ CellReference = "E1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue35 = new CellValue();
            cellValue35.Text = "4";

            cell35.Append(cellValue35);

            Cell cell36 = new Cell(){ CellReference = "F1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue36 = new CellValue();
            cellValue36.Text = "5";

            cell36.Append(cellValue36);

            Cell cell37 = new Cell(){ CellReference = "H1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue37 = new CellValue();
            cellValue37.Text = "26";

            cell37.Append(cellValue37);

            Cell cell38 = new Cell(){ CellReference = "I1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue38 = new CellValue();
            cellValue38.Text = "3";

            cell38.Append(cellValue38);

            Cell cell39 = new Cell(){ CellReference = "K1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue39 = new CellValue();
            cellValue39.Text = "27";

            cell39.Append(cellValue39);

            row16.Append(cell31);
            row16.Append(cell32);
            row16.Append(cell33);
            row16.Append(cell34);
            row16.Append(cell35);
            row16.Append(cell36);
            row16.Append(cell37);
            row16.Append(cell38);
            row16.Append(cell39);

            Row row17 = new Row(){ RowIndex = (UInt32Value)2U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell40 = new Cell(){ CellReference = "A2", StyleIndex = (UInt32Value)3U };
            CellValue cellValue40 = new CellValue();
            cellValue40.Text = "36526.579536951103";

            cell40.Append(cellValue40);

            Cell cell41 = new Cell(){ CellReference = "B2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue41 = new CellValue();
            cellValue41.Text = "22";

            cell41.Append(cellValue41);

            Cell cell42 = new Cell(){ CellReference = "C2", StyleIndex = (UInt32Value)1U };
            CellValue cellValue42 = new CellValue();
            cellValue42.Text = "13";

            cell42.Append(cellValue42);

            Cell cell43 = new Cell(){ CellReference = "D2", StyleIndex = (UInt32Value)1U };
            CellValue cellValue43 = new CellValue();
            cellValue43.Text = "1287";

            cell43.Append(cellValue43);

            Cell cell44 = new Cell(){ CellReference = "E2", StyleIndex = (UInt32Value)3U };
            CellValue cellValue44 = new CellValue();
            cellValue44.Text = "36527.188771834619";

            cell44.Append(cellValue44);

            Cell cell45 = new Cell(){ CellReference = "F2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue45 = new CellValue();
            cellValue45.Text = "19";

            cell45.Append(cellValue45);

            Cell cell46 = new Cell(){ CellReference = "H2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue46 = new CellValue();
            cellValue46.Text = "6";

            cell46.Append(cellValue46);

            Cell cell47 = new Cell(){ CellReference = "I2", StyleIndex = (UInt32Value)4U };
            CellValue cellValue47 = new CellValue();
            cellValue47.Text = "125";

            cell47.Append(cellValue47);

            Cell cell48 = new Cell(){ CellReference = "K2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue48 = new CellValue();
            cellValue48.Text = "20";

            cell48.Append(cellValue48);

            row17.Append(cell40);
            row17.Append(cell41);
            row17.Append(cell42);
            row17.Append(cell43);
            row17.Append(cell44);
            row17.Append(cell45);
            row17.Append(cell46);
            row17.Append(cell47);
            row17.Append(cell48);

            Row row18 = new Row(){ RowIndex = (UInt32Value)3U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell49 = new Cell(){ CellReference = "A3", StyleIndex = (UInt32Value)3U };
            CellValue cellValue49 = new CellValue();
            cellValue49.Text = "36526.64725983989";

            cell49.Append(cellValue49);

            Cell cell50 = new Cell(){ CellReference = "B3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue50 = new CellValue();
            cellValue50.Text = "23";

            cell50.Append(cellValue50);

            Cell cell51 = new Cell(){ CellReference = "C3", StyleIndex = (UInt32Value)1U };
            CellValue cellValue51 = new CellValue();
            cellValue51.Text = "27";

            cell51.Append(cellValue51);

            Cell cell52 = new Cell(){ CellReference = "D3", StyleIndex = (UInt32Value)1U };
            CellValue cellValue52 = new CellValue();
            cellValue52.Text = "11529";

            cell52.Append(cellValue52);

            Cell cell53 = new Cell(){ CellReference = "E3", StyleIndex = (UInt32Value)3U };
            CellValue cellValue53 = new CellValue();
            cellValue53.Text = "36529.135002922048";

            cell53.Append(cellValue53);

            Cell cell54 = new Cell(){ CellReference = "F3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue54 = new CellValue();
            cellValue54.Text = "15";

            cell54.Append(cellValue54);

            Cell cell55 = new Cell(){ CellReference = "H3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue55 = new CellValue();
            cellValue55.Text = "14";

            cell55.Append(cellValue55);

            Cell cell56 = new Cell(){ CellReference = "I3", StyleIndex = (UInt32Value)4U };
            CellValue cellValue56 = new CellValue();
            cellValue56.Text = "250";

            cell56.Append(cellValue56);

            Cell cell57 = new Cell(){ CellReference = "K3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue57 = new CellValue();
            cellValue57.Text = "9";

            cell57.Append(cellValue57);

            row18.Append(cell49);
            row18.Append(cell50);
            row18.Append(cell51);
            row18.Append(cell52);
            row18.Append(cell53);
            row18.Append(cell54);
            row18.Append(cell55);
            row18.Append(cell56);
            row18.Append(cell57);

            Row row19 = new Row(){ RowIndex = (UInt32Value)4U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell58 = new Cell(){ CellReference = "A4", StyleIndex = (UInt32Value)3U };
            CellValue cellValue58 = new CellValue();
            cellValue58.Text = "36526.705772237176";

            cell58.Append(cellValue58);

            Cell cell59 = new Cell(){ CellReference = "B4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue59 = new CellValue();
            cellValue59.Text = "22";

            cell59.Append(cellValue59);

            Cell cell60 = new Cell(){ CellReference = "C4", StyleIndex = (UInt32Value)1U };
            CellValue cellValue60 = new CellValue();
            cellValue60.Text = "19";

            cell60.Append(cellValue60);

            Cell cell61 = new Cell(){ CellReference = "D4", StyleIndex = (UInt32Value)1U };
            CellValue cellValue61 = new CellValue();
            cellValue61.Text = "1881";

            cell61.Append(cellValue61);

            Cell cell62 = new Cell(){ CellReference = "E4", StyleIndex = (UInt32Value)3U };
            CellValue cellValue62 = new CellValue();
            cellValue62.Text = "36528.465495973578";

            cell62.Append(cellValue62);

            Cell cell63 = new Cell(){ CellReference = "F4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue63 = new CellValue();
            cellValue63.Text = "13";

            cell63.Append(cellValue63);

            Cell cell64 = new Cell(){ CellReference = "H4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue64 = new CellValue();
            cellValue64.Text = "16";

            cell64.Append(cellValue64);

            Cell cell65 = new Cell(){ CellReference = "I4", StyleIndex = (UInt32Value)4U };
            CellValue cellValue65 = new CellValue();
            cellValue65.Text = "50";

            cell65.Append(cellValue65);

            Cell cell66 = new Cell(){ CellReference = "K4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue66 = new CellValue();
            cellValue66.Text = "10";

            cell66.Append(cellValue66);

            row19.Append(cell58);
            row19.Append(cell59);
            row19.Append(cell60);
            row19.Append(cell61);
            row19.Append(cell62);
            row19.Append(cell63);
            row19.Append(cell64);
            row19.Append(cell65);
            row19.Append(cell66);

            Row row20 = new Row(){ RowIndex = (UInt32Value)5U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell67 = new Cell(){ CellReference = "A5", StyleIndex = (UInt32Value)3U };
            CellValue cellValue67 = new CellValue();
            cellValue67.Text = "36526.753330643623";

            cell67.Append(cellValue67);

            Cell cell68 = new Cell(){ CellReference = "B5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue68 = new CellValue();
            cellValue68.Text = "16";

            cell68.Append(cellValue68);

            Cell cell69 = new Cell(){ CellReference = "C5", StyleIndex = (UInt32Value)1U };
            CellValue cellValue69 = new CellValue();
            cellValue69.Text = "25";

            cell69.Append(cellValue69);

            Cell cell70 = new Cell(){ CellReference = "D5", StyleIndex = (UInt32Value)1U };
            CellValue cellValue70 = new CellValue();
            cellValue70.Text = "1250";

            cell70.Append(cellValue70);

            Cell cell71 = new Cell(){ CellReference = "E5", StyleIndex = (UInt32Value)3U };
            CellValue cellValue71 = new CellValue();
            cellValue71.Text = "36527.287605233112";

            cell71.Append(cellValue71);

            Cell cell72 = new Cell(){ CellReference = "F5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue72 = new CellValue();
            cellValue72.Text = "9";

            cell72.Append(cellValue72);

            Cell cell73 = new Cell(){ CellReference = "H5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue73 = new CellValue();
            cellValue73.Text = "8";

            cell73.Append(cellValue73);

            Cell cell74 = new Cell(){ CellReference = "I5", StyleIndex = (UInt32Value)4U };
            CellValue cellValue74 = new CellValue();
            cellValue74.Text = "1230";

            cell74.Append(cellValue74);

            Cell cell75 = new Cell(){ CellReference = "K5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue75 = new CellValue();
            cellValue75.Text = "24";

            cell75.Append(cellValue75);

            row20.Append(cell67);
            row20.Append(cell68);
            row20.Append(cell69);
            row20.Append(cell70);
            row20.Append(cell71);
            row20.Append(cell72);
            row20.Append(cell73);
            row20.Append(cell74);
            row20.Append(cell75);

            Row row21 = new Row(){ RowIndex = (UInt32Value)6U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell76 = new Cell(){ CellReference = "A6", StyleIndex = (UInt32Value)3U };
            CellValue cellValue76 = new CellValue();
            cellValue76.Text = "37620.934998271434";

            cell76.Append(cellValue76);

            Cell cell77 = new Cell(){ CellReference = "B6", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue77 = new CellValue();
            cellValue77.Text = "16";

            cell77.Append(cellValue77);

            Cell cell78 = new Cell(){ CellReference = "C6", StyleIndex = (UInt32Value)1U };
            CellValue cellValue78 = new CellValue();
            cellValue78.Text = "16";

            cell78.Append(cellValue78);

            Cell cell79 = new Cell(){ CellReference = "D6", StyleIndex = (UInt32Value)1U };
            CellValue cellValue79 = new CellValue();
            cellValue79.Text = "800";

            cell79.Append(cellValue79);

            Cell cell80 = new Cell(){ CellReference = "E6", StyleIndex = (UInt32Value)3U };
            CellValue cellValue80 = new CellValue();
            cellValue80.Text = "37622.167683550928";

            cell80.Append(cellValue80);

            Cell cell81 = new Cell(){ CellReference = "F6", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue81 = new CellValue();
            cellValue81.Text = "21";

            cell81.Append(cellValue81);

            Cell cell82 = new Cell(){ CellReference = "H6", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue82 = new CellValue();
            cellValue82.Text = "11";

            cell82.Append(cellValue82);

            Cell cell83 = new Cell(){ CellReference = "I6", StyleIndex = (UInt32Value)4U };
            CellValue cellValue83 = new CellValue();
            cellValue83.Text = "78";

            cell83.Append(cellValue83);

            Cell cell84 = new Cell(){ CellReference = "K6", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue84 = new CellValue();
            cellValue84.Text = "12";

            cell84.Append(cellValue84);

            row21.Append(cell76);
            row21.Append(cell77);
            row21.Append(cell78);
            row21.Append(cell79);
            row21.Append(cell80);
            row21.Append(cell81);
            row21.Append(cell82);
            row21.Append(cell83);
            row21.Append(cell84);

            Row row22 = new Row(){ RowIndex = (UInt32Value)7U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell85 = new Cell(){ CellReference = "H7", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue85 = new CellValue();
            cellValue85.Text = "22";

            cell85.Append(cellValue85);

            Cell cell86 = new Cell(){ CellReference = "I7", StyleIndex = (UInt32Value)4U };
            CellValue cellValue86 = new CellValue();
            cellValue86.Text = "99";

            cell86.Append(cellValue86);

            Cell cell87 = new Cell(){ CellReference = "K7", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue87 = new CellValue();
            cellValue87.Text = "21";

            cell87.Append(cellValue87);

            row22.Append(cell85);
            row22.Append(cell86);
            row22.Append(cell87);

            Row row23 = new Row(){ RowIndex = (UInt32Value)8U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell88 = new Cell(){ CellReference = "H8", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue88 = new CellValue();
            cellValue88.Text = "23";

            cell88.Append(cellValue88);

            Cell cell89 = new Cell(){ CellReference = "I8", StyleIndex = (UInt32Value)4U };
            CellValue cellValue89 = new CellValue();
            cellValue89.Text = "427";

            cell89.Append(cellValue89);

            Cell cell90 = new Cell(){ CellReference = "K8", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue90 = new CellValue();
            cellValue90.Text = "7";

            cell90.Append(cellValue90);

            row23.Append(cell88);
            row23.Append(cell89);
            row23.Append(cell90);

            Row row24 = new Row(){ RowIndex = (UInt32Value)9U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell91 = new Cell(){ CellReference = "H9", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue91 = new CellValue();
            cellValue91.Text = "17";

            cell91.Append(cellValue91);

            Cell cell92 = new Cell(){ CellReference = "I9", StyleIndex = (UInt32Value)4U };
            CellValue cellValue92 = new CellValue();
            cellValue92.Text = "8127";

            cell92.Append(cellValue92);

            Cell cell93 = new Cell(){ CellReference = "K9", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue93 = new CellValue();
            cellValue93.Text = "19";

            cell93.Append(cellValue93);

            row24.Append(cell91);
            row24.Append(cell92);
            row24.Append(cell93);

            Row row25 = new Row(){ RowIndex = (UInt32Value)10U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell94 = new Cell(){ CellReference = "H10", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue94 = new CellValue();
            cellValue94.Text = "18";

            cell94.Append(cellValue94);

            Cell cell95 = new Cell(){ CellReference = "I10", StyleIndex = (UInt32Value)4U };
            CellValue cellValue95 = new CellValue();
            cellValue95.Text = "777";

            cell95.Append(cellValue95);

            Cell cell96 = new Cell(){ CellReference = "K10", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue96 = new CellValue();
            cellValue96.Text = "15";

            cell96.Append(cellValue96);

            row25.Append(cell94);
            row25.Append(cell95);
            row25.Append(cell96);

            Row row26 = new Row(){ RowIndex = (UInt32Value)11U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell97 = new Cell(){ CellReference = "H11", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue97 = new CellValue();
            cellValue97.Text = "25";

            cell97.Append(cellValue97);

            Cell cell98 = new Cell(){ CellReference = "I11", StyleIndex = (UInt32Value)4U };
            CellValue cellValue98 = new CellValue();
            cellValue98.Text = "262";

            cell98.Append(cellValue98);

            Cell cell99 = new Cell(){ CellReference = "K11", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue99 = new CellValue();
            cellValue99.Text = "13";

            cell99.Append(cellValue99);

            row26.Append(cell97);
            row26.Append(cell98);
            row26.Append(cell99);

            sheetData4.Append(row16);
            sheetData4.Append(row17);
            sheetData4.Append(row18);
            sheetData4.Append(row19);
            sheetData4.Append(row20);
            sheetData4.Append(row21);
            sheetData4.Append(row22);
            sheetData4.Append(row23);
            sheetData4.Append(row24);
            sheetData4.Append(row25);
            sheetData4.Append(row26);
            PhoneticProperties phoneticProperties10 = new PhoneticProperties(){ FontId = (UInt32Value)1U };
            PageMargins pageMargins10 = new PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };

            TableParts tableParts1 = new TableParts(){ Count = (UInt32Value)3U };
            TablePart tablePart1 = new TablePart(){ Id = "rId1" };
            TablePart tablePart2 = new TablePart(){ Id = "rId2" };
            TablePart tablePart3 = new TablePart(){ Id = "rId3" };

            tableParts1.Append(tablePart1);
            tableParts1.Append(tablePart2);
            tableParts1.Append(tablePart3);

            worksheet4.Append(sheetDimension4);
            worksheet4.Append(sheetViews4);
            worksheet4.Append(sheetFormatProperties4);
            worksheet4.Append(columns4);
            worksheet4.Append(sheetData4);
            worksheet4.Append(phoneticProperties10);
            worksheet4.Append(pageMargins10);
            worksheet4.Append(tableParts1);

            worksheetPart4.Worksheet = worksheet4;
        }
示例#22
0
        // Generates content of worksheetPart1.
        private static void GenerateWorksheetPart1Content(WorksheetPart worksheetPart1, DataTable dtSource, bool encloseInDataTable)
        {
            Worksheet worksheet1 = new Worksheet();

            worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");

            SheetData sheetData1 = new SheetData();
            // todo: refactor to use bulk xml insert if performance is slow due to large data sets
            Row row1 = new Row()
            {
                RowIndex = 1U
            };
            Cell         cell1;
            InlineString inlineString1;
            Text         text1;
            CellValue    cv;
            // add header row
            char charCol = 'A';

            foreach (DataColumn dc in dtSource.Columns)
            {
                cell1 = new Cell()
                {
                    CellReference = charCol.ToString() + "1", DataType = CellValues.InlineString
                };
                inlineString1 = new InlineString();
                text1         = new Text();
                text1.Text    = dc.ColumnName;
                inlineString1.Append(text1);
                cell1.Append(inlineString1);
                row1.Append(cell1);
                charCol = (char)((int)charCol + 1);
            }
            sheetData1.Append(row1);
            // add rows
            int rowIx = 2;

            foreach (DataRow dr in dtSource.Rows)
            {
                row1 = new Row()
                {
                    RowIndex = (uint)rowIx
                };
                charCol = 'A';
                foreach (DataColumn dc in dtSource.Columns)
                {
                    if (dc.DataType == typeof(int) || dc.DataType == typeof(decimal))
                    {
                        cell1 = new Cell()
                        {
                            CellReference = charCol.ToString() + rowIx.ToString()
                        };
                    }
                    else
                    {
                        cell1 = new Cell()
                        {
                            CellReference = charCol.ToString() + rowIx.ToString(), DataType = CellValues.String
                        };
                    }

                    cv      = new CellValue();
                    cv.Text = dr[dc.ColumnName].ToString();
                    cell1.Append(cv);
                    row1.Append(cell1);
                    charCol = (char)((int)charCol + 1);
                }
                sheetData1.Append(row1);
                rowIx++;
            }
            worksheet1.Append(sheetData1);
            string tableReferenceId = "rId2";

            if (encloseInDataTable)
            {
                TableParts tableParts1 = new TableParts()
                {
                    Count = (UInt32Value)1U
                };
                TablePart tablePart1 = new TablePart()
                {
                    Id = tableReferenceId
                };
                tableParts1.Append(tablePart1);
                worksheet1.Append(tableParts1);
            }

            worksheetPart1.Worksheet = worksheet1;

            if (encloseInDataTable)
            {
                TableDefinitionPart tableDefinitionPart1 = worksheetPart1.AddNewPart <TableDefinitionPart>(tableReferenceId);
                GenerateTableDefinitionPart1Content(tableDefinitionPart1, dtSource);
            }
        } // generate content
示例#23
0
        // Generates content of worksheetPart5.
        private void GenerateWorksheetPart5Content(WorksheetPart worksheetPart5)
        {
            Worksheet worksheet5 = new Worksheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" }  };
            worksheet5.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            worksheet5.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            worksheet5.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            SheetDimension sheetDimension5 = new SheetDimension(){ Reference = "A1:K11" };

            SheetViews sheetViews5 = new SheetViews();
            SheetView sheetView5 = new SheetView(){ TabSelected = true, WorkbookViewId = (UInt32Value)0U };

            sheetViews5.Append(sheetView5);
            SheetFormatProperties sheetFormatProperties5 = new SheetFormatProperties(){ DefaultRowHeight = 15D };

            Columns columns5 = new Columns();
            Column column25 = new Column(){ Min = (UInt32Value)1U, Max = (UInt32Value)1U, Width = 10.7109375D, BestFit = true, CustomWidth = true };
            Column column26 = new Column(){ Min = (UInt32Value)2U, Max = (UInt32Value)2U, Width = 10.140625D, BestFit = true, CustomWidth = true };
            Column column27 = new Column(){ Min = (UInt32Value)3U, Max = (UInt32Value)3U, Width = 8.140625D, BestFit = true, CustomWidth = true };
            Column column28 = new Column(){ Min = (UInt32Value)4U, Max = (UInt32Value)4U, Width = 10.42578125D, BestFit = true, CustomWidth = true };
            Column column29 = new Column(){ Min = (UInt32Value)5U, Max = (UInt32Value)5U, Width = 12.85546875D, BestFit = true, CustomWidth = true };
            Column column30 = new Column(){ Min = (UInt32Value)6U, Max = (UInt32Value)6U, Width = 11.5703125D, BestFit = true, CustomWidth = true };
            Column column31 = new Column(){ Min = (UInt32Value)8U, Max = (UInt32Value)8U, Width = 12.85546875D, BestFit = true, CustomWidth = true };
            Column column32 = new Column(){ Min = (UInt32Value)9U, Max = (UInt32Value)9U, Width = 10.42578125D, BestFit = true, CustomWidth = true };
            Column column33 = new Column(){ Min = (UInt32Value)11U, Max = (UInt32Value)11U, Width = 12.85546875D, BestFit = true, CustomWidth = true };

            columns5.Append(column25);
            columns5.Append(column26);
            columns5.Append(column27);
            columns5.Append(column28);
            columns5.Append(column29);
            columns5.Append(column30);
            columns5.Append(column31);
            columns5.Append(column32);
            columns5.Append(column33);

            SheetData sheetData5 = new SheetData();

            Row row27 = new Row(){ RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell100 = new Cell(){ CellReference = "A1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue100 = new CellValue();
            cellValue100.Text = "0";

            cell100.Append(cellValue100);

            Cell cell101 = new Cell(){ CellReference = "B1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue101 = new CellValue();
            cellValue101.Text = "1";

            cell101.Append(cellValue101);

            Cell cell102 = new Cell(){ CellReference = "C1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue102 = new CellValue();
            cellValue102.Text = "2";

            cell102.Append(cellValue102);

            Cell cell103 = new Cell(){ CellReference = "D1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue103 = new CellValue();
            cellValue103.Text = "3";

            cell103.Append(cellValue103);

            Cell cell104 = new Cell(){ CellReference = "E1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue104 = new CellValue();
            cellValue104.Text = "4";

            cell104.Append(cellValue104);

            Cell cell105 = new Cell(){ CellReference = "F1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue105 = new CellValue();
            cellValue105.Text = "5";

            cell105.Append(cellValue105);

            Cell cell106 = new Cell(){ CellReference = "H1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue106 = new CellValue();
            cellValue106.Text = "26";

            cell106.Append(cellValue106);

            Cell cell107 = new Cell(){ CellReference = "I1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue107 = new CellValue();
            cellValue107.Text = "3";

            cell107.Append(cellValue107);

            Cell cell108 = new Cell(){ CellReference = "K1", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue108 = new CellValue();
            cellValue108.Text = "27";

            cell108.Append(cellValue108);

            row27.Append(cell100);
            row27.Append(cell101);
            row27.Append(cell102);
            row27.Append(cell103);
            row27.Append(cell104);
            row27.Append(cell105);
            row27.Append(cell106);
            row27.Append(cell107);
            row27.Append(cell108);

            Row row28 = new Row(){ RowIndex = (UInt32Value)2U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell109 = new Cell(){ CellReference = "A2", StyleIndex = (UInt32Value)3U };
            CellValue cellValue109 = new CellValue();
            cellValue109.Text = "36526.653255014644";

            cell109.Append(cellValue109);

            Cell cell110 = new Cell(){ CellReference = "B2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue110 = new CellValue();
            cellValue110.Text = "6";

            cell110.Append(cellValue110);

            Cell cell111 = new Cell(){ CellReference = "C2", StyleIndex = (UInt32Value)1U };
            CellValue cellValue111 = new CellValue();
            cellValue111.Text = "19";

            cell111.Append(cellValue111);

            Cell cell112 = new Cell(){ CellReference = "D2", StyleIndex = (UInt32Value)1U };
            CellValue cellValue112 = new CellValue();
            cellValue112.Text = "2375";

            cell112.Append(cellValue112);

            Cell cell113 = new Cell(){ CellReference = "E2", StyleIndex = (UInt32Value)3U };
            CellValue cellValue113 = new CellValue();
            cellValue113.Text = "36531.653255014644";

            cell113.Append(cellValue113);

            Cell cell114 = new Cell(){ CellReference = "F2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue114 = new CellValue();
            cellValue114.Text = "7";

            cell114.Append(cellValue114);

            Cell cell115 = new Cell(){ CellReference = "H2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue115 = new CellValue();
            cellValue115.Text = "6";

            cell115.Append(cellValue115);

            Cell cell116 = new Cell(){ CellReference = "I2", StyleIndex = (UInt32Value)4U };
            CellValue cellValue116 = new CellValue();
            cellValue116.Text = "125";

            cell116.Append(cellValue116);

            Cell cell117 = new Cell(){ CellReference = "K2", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue117 = new CellValue();
            cellValue117.Text = "20";

            cell117.Append(cellValue117);

            row28.Append(cell109);
            row28.Append(cell110);
            row28.Append(cell111);
            row28.Append(cell112);
            row28.Append(cell113);
            row28.Append(cell114);
            row28.Append(cell115);
            row28.Append(cell116);
            row28.Append(cell117);

            Row row29 = new Row(){ RowIndex = (UInt32Value)3U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell118 = new Cell(){ CellReference = "A3", StyleIndex = (UInt32Value)3U };
            CellValue cellValue118 = new CellValue();
            cellValue118.Text = "36527.149391461739";

            cell118.Append(cellValue118);

            Cell cell119 = new Cell(){ CellReference = "B3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue119 = new CellValue();
            cellValue119.Text = "8";

            cell119.Append(cellValue119);

            Cell cell120 = new Cell(){ CellReference = "C3", StyleIndex = (UInt32Value)1U };
            CellValue cellValue120 = new CellValue();
            cellValue120.Text = "13";

            cell120.Append(cellValue120);

            Cell cell121 = new Cell(){ CellReference = "D3", StyleIndex = (UInt32Value)1U };
            CellValue cellValue121 = new CellValue();
            cellValue121.Text = "15990";

            cell121.Append(cellValue121);

            Cell cell122 = new Cell(){ CellReference = "E3", StyleIndex = (UInt32Value)3U };
            CellValue cellValue122 = new CellValue();
            cellValue122.Text = "36532.149391461739";

            cell122.Append(cellValue122);

            Cell cell123 = new Cell(){ CellReference = "F3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue123 = new CellValue();
            cellValue123.Text = "9";

            cell123.Append(cellValue123);

            Cell cell124 = new Cell(){ CellReference = "H3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue124 = new CellValue();
            cellValue124.Text = "14";

            cell124.Append(cellValue124);

            Cell cell125 = new Cell(){ CellReference = "I3", StyleIndex = (UInt32Value)4U };
            CellValue cellValue125 = new CellValue();
            cellValue125.Text = "250";

            cell125.Append(cellValue125);

            Cell cell126 = new Cell(){ CellReference = "K3", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue126 = new CellValue();
            cellValue126.Text = "9";

            cell126.Append(cellValue126);

            row29.Append(cell118);
            row29.Append(cell119);
            row29.Append(cell120);
            row29.Append(cell121);
            row29.Append(cell122);
            row29.Append(cell123);
            row29.Append(cell124);
            row29.Append(cell125);
            row29.Append(cell126);

            Row row30 = new Row(){ RowIndex = (UInt32Value)4U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell127 = new Cell(){ CellReference = "A4", StyleIndex = (UInt32Value)3U };
            CellValue cellValue127 = new CellValue();
            cellValue127.Text = "37620.280037325079";

            cell127.Append(cellValue127);

            Cell cell128 = new Cell(){ CellReference = "B4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue128 = new CellValue();
            cellValue128.Text = "11";

            cell128.Append(cellValue128);

            Cell cell129 = new Cell(){ CellReference = "C4", StyleIndex = (UInt32Value)1U };
            CellValue cellValue129 = new CellValue();
            cellValue129.Text = "4";

            cell129.Append(cellValue129);

            Cell cell130 = new Cell(){ CellReference = "D4", StyleIndex = (UInt32Value)1U };
            CellValue cellValue130 = new CellValue();
            cellValue130.Text = "312";

            cell130.Append(cellValue130);

            Cell cell131 = new Cell(){ CellReference = "E4", StyleIndex = (UInt32Value)3U };
            CellValue cellValue131 = new CellValue();
            cellValue131.Text = "37624.280037325079";

            cell131.Append(cellValue131);

            Cell cell132 = new Cell(){ CellReference = "F4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue132 = new CellValue();
            cellValue132.Text = "12";

            cell132.Append(cellValue132);

            Cell cell133 = new Cell(){ CellReference = "H4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue133 = new CellValue();
            cellValue133.Text = "16";

            cell133.Append(cellValue133);

            Cell cell134 = new Cell(){ CellReference = "I4", StyleIndex = (UInt32Value)4U };
            CellValue cellValue134 = new CellValue();
            cellValue134.Text = "50";

            cell134.Append(cellValue134);

            Cell cell135 = new Cell(){ CellReference = "K4", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue135 = new CellValue();
            cellValue135.Text = "10";

            cell135.Append(cellValue135);

            row30.Append(cell127);
            row30.Append(cell128);
            row30.Append(cell129);
            row30.Append(cell130);
            row30.Append(cell131);
            row30.Append(cell132);
            row30.Append(cell133);
            row30.Append(cell134);
            row30.Append(cell135);

            Row row31 = new Row(){ RowIndex = (UInt32Value)5U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell136 = new Cell(){ CellReference = "A5", StyleIndex = (UInt32Value)3U };
            CellValue cellValue136 = new CellValue();
            cellValue136.Text = "37620.86855653645";

            cell136.Append(cellValue136);

            Cell cell137 = new Cell(){ CellReference = "B5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue137 = new CellValue();
            cellValue137.Text = "11";

            cell137.Append(cellValue137);

            Cell cell138 = new Cell(){ CellReference = "C5", StyleIndex = (UInt32Value)1U };
            CellValue cellValue138 = new CellValue();
            cellValue138.Text = "29";

            cell138.Append(cellValue138);

            Cell cell139 = new Cell(){ CellReference = "D5", StyleIndex = (UInt32Value)1U };
            CellValue cellValue139 = new CellValue();
            cellValue139.Text = "2262";

            cell139.Append(cellValue139);

            Cell cell140 = new Cell(){ CellReference = "E5", StyleIndex = (UInt32Value)3U };
            CellValue cellValue140 = new CellValue();
            cellValue140.Text = "37621.86855653645";

            cell140.Append(cellValue140);

            Cell cell141 = new Cell(){ CellReference = "F5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue141 = new CellValue();
            cellValue141.Text = "12";

            cell141.Append(cellValue141);

            Cell cell142 = new Cell(){ CellReference = "H5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue142 = new CellValue();
            cellValue142.Text = "8";

            cell142.Append(cellValue142);

            Cell cell143 = new Cell(){ CellReference = "I5", StyleIndex = (UInt32Value)4U };
            CellValue cellValue143 = new CellValue();
            cellValue143.Text = "1230";

            cell143.Append(cellValue143);

            Cell cell144 = new Cell(){ CellReference = "K5", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue144 = new CellValue();
            cellValue144.Text = "24";

            cell144.Append(cellValue144);

            row31.Append(cell136);
            row31.Append(cell137);
            row31.Append(cell138);
            row31.Append(cell139);
            row31.Append(cell140);
            row31.Append(cell141);
            row31.Append(cell142);
            row31.Append(cell143);
            row31.Append(cell144);

            Row row32 = new Row(){ RowIndex = (UInt32Value)6U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell145 = new Cell(){ CellReference = "H6", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue145 = new CellValue();
            cellValue145.Text = "11";

            cell145.Append(cellValue145);

            Cell cell146 = new Cell(){ CellReference = "I6", StyleIndex = (UInt32Value)4U };
            CellValue cellValue146 = new CellValue();
            cellValue146.Text = "78";

            cell146.Append(cellValue146);

            Cell cell147 = new Cell(){ CellReference = "K6", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue147 = new CellValue();
            cellValue147.Text = "12";

            cell147.Append(cellValue147);

            row32.Append(cell145);
            row32.Append(cell146);
            row32.Append(cell147);

            Row row33 = new Row(){ RowIndex = (UInt32Value)7U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell148 = new Cell(){ CellReference = "H7", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue148 = new CellValue();
            cellValue148.Text = "22";

            cell148.Append(cellValue148);

            Cell cell149 = new Cell(){ CellReference = "I7", StyleIndex = (UInt32Value)4U };
            CellValue cellValue149 = new CellValue();
            cellValue149.Text = "99";

            cell149.Append(cellValue149);

            Cell cell150 = new Cell(){ CellReference = "K7", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue150 = new CellValue();
            cellValue150.Text = "21";

            cell150.Append(cellValue150);

            row33.Append(cell148);
            row33.Append(cell149);
            row33.Append(cell150);

            Row row34 = new Row(){ RowIndex = (UInt32Value)8U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell151 = new Cell(){ CellReference = "H8", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue151 = new CellValue();
            cellValue151.Text = "23";

            cell151.Append(cellValue151);

            Cell cell152 = new Cell(){ CellReference = "I8", StyleIndex = (UInt32Value)4U };
            CellValue cellValue152 = new CellValue();
            cellValue152.Text = "427";

            cell152.Append(cellValue152);

            Cell cell153 = new Cell(){ CellReference = "K8", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue153 = new CellValue();
            cellValue153.Text = "7";

            cell153.Append(cellValue153);

            row34.Append(cell151);
            row34.Append(cell152);
            row34.Append(cell153);

            Row row35 = new Row(){ RowIndex = (UInt32Value)9U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell154 = new Cell(){ CellReference = "H9", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue154 = new CellValue();
            cellValue154.Text = "17";

            cell154.Append(cellValue154);

            Cell cell155 = new Cell(){ CellReference = "I9", StyleIndex = (UInt32Value)4U };
            CellValue cellValue155 = new CellValue();
            cellValue155.Text = "8127";

            cell155.Append(cellValue155);

            Cell cell156 = new Cell(){ CellReference = "K9", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue156 = new CellValue();
            cellValue156.Text = "19";

            cell156.Append(cellValue156);

            row35.Append(cell154);
            row35.Append(cell155);
            row35.Append(cell156);

            Row row36 = new Row(){ RowIndex = (UInt32Value)10U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell157 = new Cell(){ CellReference = "H10", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue157 = new CellValue();
            cellValue157.Text = "18";

            cell157.Append(cellValue157);

            Cell cell158 = new Cell(){ CellReference = "I10", StyleIndex = (UInt32Value)4U };
            CellValue cellValue158 = new CellValue();
            cellValue158.Text = "777";

            cell158.Append(cellValue158);

            Cell cell159 = new Cell(){ CellReference = "K10", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue159 = new CellValue();
            cellValue159.Text = "15";

            cell159.Append(cellValue159);

            row36.Append(cell157);
            row36.Append(cell158);
            row36.Append(cell159);

            Row row37 = new Row(){ RowIndex = (UInt32Value)11U, Spans = new ListValue<StringValue>() { InnerText = "1:11" } };

            Cell cell160 = new Cell(){ CellReference = "H11", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue160 = new CellValue();
            cellValue160.Text = "25";

            cell160.Append(cellValue160);

            Cell cell161 = new Cell(){ CellReference = "I11", StyleIndex = (UInt32Value)4U };
            CellValue cellValue161 = new CellValue();
            cellValue161.Text = "262";

            cell161.Append(cellValue161);

            Cell cell162 = new Cell(){ CellReference = "K11", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue162 = new CellValue();
            cellValue162.Text = "13";

            cell162.Append(cellValue162);

            row37.Append(cell160);
            row37.Append(cell161);
            row37.Append(cell162);

            sheetData5.Append(row27);
            sheetData5.Append(row28);
            sheetData5.Append(row29);
            sheetData5.Append(row30);
            sheetData5.Append(row31);
            sheetData5.Append(row32);
            sheetData5.Append(row33);
            sheetData5.Append(row34);
            sheetData5.Append(row35);
            sheetData5.Append(row36);
            sheetData5.Append(row37);
            PhoneticProperties phoneticProperties11 = new PhoneticProperties(){ FontId = (UInt32Value)1U };
            PageMargins pageMargins11 = new PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };

            TableParts tableParts2 = new TableParts(){ Count = (UInt32Value)3U };
            TablePart tablePart4 = new TablePart(){ Id = "rId1" };
            TablePart tablePart5 = new TablePart(){ Id = "rId2" };
            TablePart tablePart6 = new TablePart(){ Id = "rId3" };

            tableParts2.Append(tablePart4);
            tableParts2.Append(tablePart5);
            tableParts2.Append(tablePart6);

            worksheet5.Append(sheetDimension5);
            worksheet5.Append(sheetViews5);
            worksheet5.Append(sheetFormatProperties5);
            worksheet5.Append(columns5);
            worksheet5.Append(sheetData5);
            worksheet5.Append(phoneticProperties11);
            worksheet5.Append(pageMargins11);
            worksheet5.Append(tableParts2);

            worksheetPart5.Worksheet = worksheet5;
        }
        // Generates content of worksheetPart2.
        private void GenerateWorksheetPart2Content(WorksheetPart worksheetPart2)
        {
            Worksheet worksheet2 = new Worksheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } };
            worksheet2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            worksheet2.AddNamespaceDeclaration("xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
            worksheet2.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
            worksheet2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            worksheet2.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            SheetDimension sheetDimension2 = new SheetDimension() { Reference = "A1:V19" };

            SheetViews sheetViews2 = new SheetViews();

            SheetView sheetView2 = new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U };
            Selection selection2 = new Selection() { ActiveCell = "X5", SequenceOfReferences = new ListValue<StringValue>() { InnerText = "X5" } };

            sheetView2.Append(selection2);

            sheetViews2.Append(sheetView2);
            SheetFormatProperties sheetFormatProperties2 = new SheetFormatProperties() { DefaultRowHeight = 15D, DyDescent = 0.25D };

            SheetData sheetData2 = new SheetData();

            Row row2 = new Row() { RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell2 = new Cell() { CellReference = "A1" };
            CellValue cellValue2 = new CellValue();
            cellValue2.Text = "1";

            cell2.Append(cellValue2);

            Cell cell3 = new Cell() { CellReference = "C1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
            CellValue cellValue3 = new CellValue();
            cellValue3.Text = "0";

            cell3.Append(cellValue3);

            row2.Append(cell2);
            row2.Append(cell3);

            Row row3 = new Row() { RowIndex = (UInt32Value)2U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell4 = new Cell() { CellReference = "A2" };
            CellValue cellValue4 = new CellValue();
            cellValue4.Text = "2";

            cell4.Append(cellValue4);

            row3.Append(cell4);

            Row row4 = new Row() { RowIndex = (UInt32Value)3U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell5 = new Cell() { CellReference = "A3" };
            CellValue cellValue5 = new CellValue();
            cellValue5.Text = "3";

            cell5.Append(cellValue5);

            row4.Append(cell5);

            Row row5 = new Row() { RowIndex = (UInt32Value)4U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, Height = 135D, DyDescent = 0.25D };

            Cell cell6 = new Cell() { CellReference = "A4" };
            CellValue cellValue6 = new CellValue();
            cellValue6.Text = "4";

            cell6.Append(cellValue6);

            Cell cell7 = new Cell() { CellReference = "C4", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString };
            CellValue cellValue7 = new CellValue();
            cellValue7.Text = "1";

            cell7.Append(cellValue7);

            row5.Append(cell6);
            row5.Append(cell7);

            Row row6 = new Row() { RowIndex = (UInt32Value)5U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell8 = new Cell() { CellReference = "A5" };
            CellValue cellValue8 = new CellValue();
            cellValue8.Text = "5";

            cell8.Append(cellValue8);

            Cell cell9 = new Cell() { CellReference = "Q5", StyleIndex = (UInt32Value)3U, DataType = CellValues.SharedString };
            CellValue cellValue9 = new CellValue();
            cellValue9.Text = "6";

            cell9.Append(cellValue9);

            Cell cell10 = new Cell() { CellReference = "T5" };
            CellValue cellValue10 = new CellValue();
            cellValue10.Text = "4";

            cell10.Append(cellValue10);

            row6.Append(cell8);
            row6.Append(cell9);
            row6.Append(cell10);

            Row row7 = new Row() { RowIndex = (UInt32Value)6U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell11 = new Cell() { CellReference = "A6" };
            CellFormula cellFormula1 = new CellFormula();
            cellFormula1.Text = "SUM(A1:A5)";
            CellValue cellValue11 = new CellValue();
            cellValue11.Text = "15";

            cell11.Append(cellFormula1);
            cell11.Append(cellValue11);

            Cell cell12 = new Cell() { CellReference = "T6" };
            CellValue cellValue12 = new CellValue();
            cellValue12.Text = "7";

            cell12.Append(cellValue12);

            row7.Append(cell11);
            row7.Append(cell12);

            Row row8 = new Row() { RowIndex = (UInt32Value)7U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell13 = new Cell() { CellReference = "T7" };
            CellValue cellValue13 = new CellValue();
            cellValue13.Text = "6";

            cell13.Append(cellValue13);

            row8.Append(cell13);

            Row row9 = new Row() { RowIndex = (UInt32Value)8U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell14 = new Cell() { CellReference = "T8" };
            CellValue cellValue14 = new CellValue();
            cellValue14.Text = "5";

            cell14.Append(cellValue14);

            row9.Append(cell14);

            Row row10 = new Row() { RowIndex = (UInt32Value)9U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell15 = new Cell() { CellReference = "T9" };
            CellValue cellValue15 = new CellValue();
            cellValue15.Text = "4";

            cell15.Append(cellValue15);

            row10.Append(cell15);

            Row row11 = new Row() { RowIndex = (UInt32Value)10U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D };

            Cell cell16 = new Cell() { CellReference = "T10" };
            CellValue cellValue16 = new CellValue();
            cellValue16.Text = "7";

            cell16.Append(cellValue16);

            row11.Append(cell16);

            Row row12 = new Row() { RowIndex = (UInt32Value)17U, Spans = new ListValue<StringValue>() { InnerText = "1:3" }, DyDescent = 0.25D };

            Cell cell17 = new Cell() { CellReference = "A17", DataType = CellValues.SharedString };
            CellValue cellValue17 = new CellValue();
            cellValue17.Text = "3";

            cell17.Append(cellValue17);

            Cell cell18 = new Cell() { CellReference = "B17", DataType = CellValues.SharedString };
            CellValue cellValue18 = new CellValue();
            cellValue18.Text = "4";

            cell18.Append(cellValue18);

            Cell cell19 = new Cell() { CellReference = "C17", DataType = CellValues.SharedString };
            CellValue cellValue19 = new CellValue();
            cellValue19.Text = "5";

            cell19.Append(cellValue19);

            row12.Append(cell17);
            row12.Append(cell18);
            row12.Append(cell19);

            Row row13 = new Row() { RowIndex = (UInt32Value)18U, Spans = new ListValue<StringValue>() { InnerText = "1:3" }, DyDescent = 0.25D };

            Cell cell20 = new Cell() { CellReference = "A18" };
            CellValue cellValue20 = new CellValue();
            cellValue20.Text = "1";

            cell20.Append(cellValue20);

            Cell cell21 = new Cell() { CellReference = "B18" };
            CellValue cellValue21 = new CellValue();
            cellValue21.Text = "2";

            cell21.Append(cellValue21);

            Cell cell22 = new Cell() { CellReference = "C18" };
            CellValue cellValue22 = new CellValue();
            cellValue22.Text = "3";

            cell22.Append(cellValue22);

            row13.Append(cell20);
            row13.Append(cell21);
            row13.Append(cell22);

            Row row14 = new Row() { RowIndex = (UInt32Value)19U, Spans = new ListValue<StringValue>() { InnerText = "1:3" }, DyDescent = 0.25D };

            Cell cell23 = new Cell() { CellReference = "A19" };
            CellValue cellValue23 = new CellValue();
            cellValue23.Text = "4";

            cell23.Append(cellValue23);

            Cell cell24 = new Cell() { CellReference = "B19" };
            CellValue cellValue24 = new CellValue();
            cellValue24.Text = "5";

            cell24.Append(cellValue24);

            Cell cell25 = new Cell() { CellReference = "C19" };
            CellValue cellValue25 = new CellValue();
            cellValue25.Text = "6";

            cell25.Append(cellValue25);

            row14.Append(cell23);
            row14.Append(cell24);
            row14.Append(cell25);

            sheetData2.Append(row2);
            sheetData2.Append(row3);
            sheetData2.Append(row4);
            sheetData2.Append(row5);
            sheetData2.Append(row6);
            sheetData2.Append(row7);
            sheetData2.Append(row8);
            sheetData2.Append(row9);
            sheetData2.Append(row10);
            sheetData2.Append(row11);
            sheetData2.Append(row12);
            sheetData2.Append(row13);
            sheetData2.Append(row14);

            Hyperlinks hyperlinks1 = new Hyperlinks();
            Hyperlink hyperlink2 = new Hyperlink() { Reference = "Q5", Id = "rId1" };

            hyperlinks1.Append(hyperlink2);
            PageMargins pageMargins2 = new PageMargins() { Left = 0.25D, Right = 0.25D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            PageSetup pageSetup1 = new PageSetup() { Orientation = OrientationValues.Landscape, HorizontalDpi = (UInt32Value)4294967293U, VerticalDpi = (UInt32Value)0U, Id = "rId2" };
            S.Drawing drawing3 = new S.Drawing() { Id = "rId3" };
            LegacyDrawing legacyDrawing1 = new LegacyDrawing() { Id = "rId4" };

            TableParts tableParts1 = new TableParts() { Count = (UInt32Value)1U };
            TablePart tablePart1 = new TablePart() { Id = "rId5" };

            tableParts1.Append(tablePart1);

            worksheet2.Append(sheetDimension2);
            worksheet2.Append(sheetViews2);
            worksheet2.Append(sheetFormatProperties2);
            worksheet2.Append(sheetData2);
            worksheet2.Append(hyperlinks1);
            worksheet2.Append(pageMargins2);
            worksheet2.Append(pageSetup1);
            worksheet2.Append(drawing3);
            worksheet2.Append(legacyDrawing1);
            worksheet2.Append(tableParts1);

            worksheetPart2.Worksheet = worksheet2;
        }
示例#25
0
        // Generates content of worksheetPart1.
        private void GenerateWorksheetPart1Content(WorksheetPart worksheetPart1)
        {
            Worksheet worksheet1 = new Worksheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" }  };
            worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            worksheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            worksheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            SheetDimension sheetDimension1 = new SheetDimension(){ Reference = "A1:G4" };

            SheetViews sheetViews1 = new SheetViews();
            SheetView sheetView1 = new SheetView(){ TabSelected = true, WorkbookViewId = (UInt32Value)0U };

            sheetViews1.Append(sheetView1);
            SheetFormatProperties sheetFormatProperties1 = new SheetFormatProperties(){ DefaultRowHeight = 15D };

            Columns columns1 = new Columns();
            Column column1 = new Column(){ Min = (UInt32Value)1U, Max = (UInt32Value)3U, Width = 10.5703125D, CustomWidth = true };
            Column column2 = new Column(){ Min = (UInt32Value)5U, Max = (UInt32Value)7U, Width = 10.5703125D, CustomWidth = true };

            columns1.Append(column1);
            columns1.Append(column2);

            SheetData sheetData1 = new SheetData();

            Row row1 = new Row(){ RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:7" } };

            Cell cell1 = new Cell(){ CellReference = "A1", DataType = CellValues.SharedString };
            CellValue cellValue1 = new CellValue();
            cellValue1.Text = "12";

            cell1.Append(cellValue1);

            Cell cell2 = new Cell(){ CellReference = "B1", DataType = CellValues.SharedString };
            CellValue cellValue2 = new CellValue();
            cellValue2.Text = "13";

            cell2.Append(cellValue2);

            Cell cell3 = new Cell(){ CellReference = "C1", DataType = CellValues.SharedString };
            CellValue cellValue3 = new CellValue();
            cellValue3.Text = "14";

            cell3.Append(cellValue3);

            Cell cell4 = new Cell(){ CellReference = "E1", DataType = CellValues.SharedString };
            CellValue cellValue4 = new CellValue();
            cellValue4.Text = "12";

            cell4.Append(cellValue4);

            Cell cell5 = new Cell(){ CellReference = "F1", DataType = CellValues.SharedString };
            CellValue cellValue5 = new CellValue();
            cellValue5.Text = "13";

            cell5.Append(cellValue5);

            Cell cell6 = new Cell(){ CellReference = "G1", DataType = CellValues.SharedString };
            CellValue cellValue6 = new CellValue();
            cellValue6.Text = "14";

            cell6.Append(cellValue6);

            row1.Append(cell1);
            row1.Append(cell2);
            row1.Append(cell3);
            row1.Append(cell4);
            row1.Append(cell5);
            row1.Append(cell6);

            Row row2 = new Row(){ RowIndex = (UInt32Value)2U, Spans = new ListValue<StringValue>() { InnerText = "1:7" } };

            Cell cell7 = new Cell(){ CellReference = "A2", DataType = CellValues.SharedString };
            CellValue cellValue7 = new CellValue();
            cellValue7.Text = "0";

            cell7.Append(cellValue7);

            Cell cell8 = new Cell(){ CellReference = "B2", DataType = CellValues.SharedString };
            CellValue cellValue8 = new CellValue();
            cellValue8.Text = "2";

            cell8.Append(cellValue8);

            Cell cell9 = new Cell(){ CellReference = "C2" };
            CellValue cellValue9 = new CellValue();
            cellValue9.Text = "1";

            cell9.Append(cellValue9);

            Cell cell10 = new Cell(){ CellReference = "E2", DataType = CellValues.SharedString };
            CellValue cellValue10 = new CellValue();
            cellValue10.Text = "4";

            cell10.Append(cellValue10);

            Cell cell11 = new Cell(){ CellReference = "F2", DataType = CellValues.SharedString };
            CellValue cellValue11 = new CellValue();
            cellValue11.Text = "9";

            cell11.Append(cellValue11);

            Cell cell12 = new Cell(){ CellReference = "G2" };
            CellValue cellValue12 = new CellValue();
            cellValue12.Text = "3";

            cell12.Append(cellValue12);

            row2.Append(cell7);
            row2.Append(cell8);
            row2.Append(cell9);
            row2.Append(cell10);
            row2.Append(cell11);
            row2.Append(cell12);

            Row row3 = new Row(){ RowIndex = (UInt32Value)3U, Spans = new ListValue<StringValue>() { InnerText = "1:7" } };

            Cell cell13 = new Cell(){ CellReference = "A3", DataType = CellValues.SharedString };
            CellValue cellValue13 = new CellValue();
            cellValue13.Text = "1";

            cell13.Append(cellValue13);

            Cell cell14 = new Cell(){ CellReference = "B3", DataType = CellValues.SharedString };
            CellValue cellValue14 = new CellValue();
            cellValue14.Text = "3";

            cell14.Append(cellValue14);

            Cell cell15 = new Cell(){ CellReference = "C3" };
            CellValue cellValue15 = new CellValue();
            cellValue15.Text = "2";

            cell15.Append(cellValue15);

            Cell cell16 = new Cell(){ CellReference = "E3", DataType = CellValues.SharedString };
            CellValue cellValue16 = new CellValue();
            cellValue16.Text = "5";

            cell16.Append(cellValue16);

            Cell cell17 = new Cell(){ CellReference = "F3", DataType = CellValues.SharedString };
            CellValue cellValue17 = new CellValue();
            cellValue17.Text = "10";

            cell17.Append(cellValue17);

            Cell cell18 = new Cell(){ CellReference = "G3" };
            CellValue cellValue18 = new CellValue();
            cellValue18.Text = "4";

            cell18.Append(cellValue18);

            row3.Append(cell13);
            row3.Append(cell14);
            row3.Append(cell15);
            row3.Append(cell16);
            row3.Append(cell17);
            row3.Append(cell18);

            Row row4 = new Row(){ RowIndex = (UInt32Value)4U, Spans = new ListValue<StringValue>() { InnerText = "1:7" } };

            Cell cell19 = new Cell(){ CellReference = "A4", DataType = CellValues.SharedString };
            CellValue cellValue19 = new CellValue();
            cellValue19.Text = "6";

            cell19.Append(cellValue19);

            Cell cell20 = new Cell(){ CellReference = "B4", DataType = CellValues.SharedString };
            CellValue cellValue20 = new CellValue();
            cellValue20.Text = "7";

            cell20.Append(cellValue20);

            Cell cell21 = new Cell(){ CellReference = "C4" };
            CellValue cellValue21 = new CellValue();
            cellValue21.Text = "3";

            cell21.Append(cellValue21);

            Cell cell22 = new Cell(){ CellReference = "E4", DataType = CellValues.SharedString };
            CellValue cellValue22 = new CellValue();
            cellValue22.Text = "8";

            cell22.Append(cellValue22);

            Cell cell23 = new Cell(){ CellReference = "F4", DataType = CellValues.SharedString };
            CellValue cellValue23 = new CellValue();
            cellValue23.Text = "11";

            cell23.Append(cellValue23);

            Cell cell24 = new Cell(){ CellReference = "G4" };
            CellValue cellValue24 = new CellValue();
            cellValue24.Text = "5";

            cell24.Append(cellValue24);

            row4.Append(cell19);
            row4.Append(cell20);
            row4.Append(cell21);
            row4.Append(cell22);
            row4.Append(cell23);
            row4.Append(cell24);

            sheetData1.Append(row1);
            sheetData1.Append(row2);
            sheetData1.Append(row3);
            sheetData1.Append(row4);
            PhoneticProperties phoneticProperties13 = new PhoneticProperties(){ FontId = (UInt32Value)1U };
            PageMargins pageMargins1 = new PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            S.Drawing drawing1 = new S.Drawing(){ Id = "rId1" };

            TableParts tableParts1 = new TableParts(){ Count = (UInt32Value)2U };
            TablePart tablePart1 = new TablePart(){ Id = "rId2" };
            TablePart tablePart2 = new TablePart(){ Id = "rId3" };

            tableParts1.Append(tablePart1);
            tableParts1.Append(tablePart2);

            WorksheetExtensionList worksheetExtensionList1 = new WorksheetExtensionList();

            WorksheetExtension worksheetExtension1 = new WorksheetExtension(){ Uri = "{3A4CF648-6AED-40f4-86FF-DC5316D8AED3}" };
            worksheetExtension1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");

            X14.SlicerList slicerList1 = new X14.SlicerList();
            slicerList1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
            X14.SlicerRef slicerRef1 = new X14.SlicerRef(){ Id = "rId4" };

            slicerList1.Append(slicerRef1);

            worksheetExtension1.Append(slicerList1);

            worksheetExtensionList1.Append(worksheetExtension1);

            worksheet1.Append(sheetDimension1);
            worksheet1.Append(sheetViews1);
            worksheet1.Append(sheetFormatProperties1);
            worksheet1.Append(columns1);
            worksheet1.Append(sheetData1);
            worksheet1.Append(phoneticProperties13);
            worksheet1.Append(pageMargins1);
            worksheet1.Append(drawing1);
            worksheet1.Append(tableParts1);
            worksheet1.Append(worksheetExtensionList1);

            worksheetPart1.Worksheet = worksheet1;
        }
示例#26
0
        public static Table AddTable(this Worksheet worksheet, int rowStart, int rowCount, int columnStart, params string[] headers)
        {
            if (rowCount == 1)
            {
                rowCount++;
            }

            string range = ComputeRange(rowStart, rowCount, columnStart, headers.Length);

            var sheetViews = worksheet.GetFirstChild <SheetViews>();

            if (sheetViews == null)
            {
                sheetViews = worksheet.InsertAt(new SheetViews(), 0);
            }

            var sheetView = sheetViews.AppendChild(new SheetView());

            sheetView.WorkbookViewId = 0;

            var selection = sheetView.AppendChild(new Selection());

            selection.SequenceOfReferences = new ListValue <StringValue>()
            {
                InnerText = range
            };
            selection.ActiveCell = range.Substring(0, range.IndexOf(":", StringComparison.Ordinal));

            var tableDefPart = worksheet.WorksheetPart.AddNewPart <TableDefinitionPart>();

            // use unique ids for tables.
            uint tableID = IncrementalUniqueId;

            var tp = new TablePart
            {
                Id = worksheet.WorksheetPart.GetIdOfPart(tableDefPart)
            };
            var tableParts = worksheet.GetFirstChild <TableParts>();

            if (tableParts == null)
            {
                tableParts = worksheet.AppendChild(new TableParts());
            }

            tableParts.AppendChild(tp);

            tableDefPart.Table = new Table()
            {
                Id          = tableID,
                Name        = tableID.ToString(CultureInfo.CurrentCulture),
                DisplayName = "Table" + tableID.ToString(CultureInfo.CurrentCulture)
            };
            tableDefPart.Table.Reference = range;

            uint columnCount = (uint)headers.Length;
            var  tc          = tableDefPart.Table.AppendChild(new TableColumns()
            {
                Count = columnCount
            });

            for (uint i = 0; i < columnCount; i++)
            {
                tc.AppendChild(new TableColumn()
                {
                    Id = i + 1, Name = headers[i]
                });
            }

            tableDefPart.Table.AutoFilter = new AutoFilter
            {
                Reference = range
            };

            var styleInfo = tableDefPart.Table.AppendChild(new TableStyleInfo());

            styleInfo.Name              = "TableStyleMedium2";
            styleInfo.ShowFirstColumn   = false;
            styleInfo.ShowRowStripes    = true;
            styleInfo.ShowLastColumn    = false;
            styleInfo.ShowColumnStripes = false;

            return(tableDefPart.Table);
        }
示例#27
0
        /// <summary>
        /// Generate Excel Document.
        /// </summary>
        /// <param name="reportResult">QueryResult</param>
        /// <returns>MemoryStream</returns>
        public static MemoryStream CreateExcelDocument(ReportResult reportResult, List <DataRow> rows)
        {
            sharedStringIndex = 0;
            sharedStrings     = new ConcurrentDictionary <int, string>();
            var ms = new MemoryStream();

            using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Create(ms, SpreadsheetDocumentType.Workbook, true))
            {
                // Create the Workbook
                WorkbookPart workbookPart = spreadSheet.AddWorkbookPart();
                spreadSheet.WorkbookPart.Workbook = new Workbook();

                // A Workbook must only have exactly one <Sheets> section
                spreadSheet.WorkbookPart.Workbook.AppendChild(new Sheets());

                WorksheetPart newWorksheetPart = spreadSheet.WorkbookPart.AddNewPart <WorksheetPart>("rId1");
                newWorksheetPart.Worksheet = new Worksheet();


                //Add columns of constant width
                int     columnIndx = 1;
                Columns cols       = new Columns();
                foreach (ReportColumn column in reportResult.Metadata.ReportColumns.Values)
                {
                    if (!column.IsHidden && column.Type != "Image")
                    {
                        cols.Append(CreateColumnData(columnIndx));
                        columnIndx++;
                    }
                }
                newWorksheetPart.Worksheet.Append(cols);
                newWorksheetPart.Worksheet.Save();

                // Create a new Excel worksheet
                SheetData sheetData = newWorksheetPart.Worksheet.AppendChild(new SheetData());

                // Create Styles and Insert into Workbook
                WorkbookStylesPart stylesPart = workbookPart.AddNewPart <WorkbookStylesPart>("rId3");
                Stylesheet         styles     = new ExportDataStylesheet();
                styles.Save(stylesPart);

                // Insert Datatable data into the worksheet.
                InsertTableData(reportResult, sheetData, rows);

                //Create table part.
                TableDefinitionPart tableDefinitionPart = newWorksheetPart.AddNewPart <TableDefinitionPart>("rId1");
                GenerateTablePartContent(tableDefinitionPart, reportResult, rows, columnIndx - 2);
                TableParts tableParts1 = new TableParts()
                {
                    Count = (UInt32Value)1U
                };
                TablePart tablePart1 = new TablePart()
                {
                    Id = "rId1"
                };
                tableParts1.Append(tablePart1);
                newWorksheetPart.Worksheet.Append(tableParts1);
                newWorksheetPart.Worksheet.Save();

                //add shared stringd
                SharedStringTablePart sharedStringTablePart = spreadSheet.WorkbookPart.AddNewPart <SharedStringTablePart>("rId2");
                SharedStringTable     sharedStringTable     = new SharedStringTable();
                foreach (string sharedString in sharedStrings.Values)
                {
                    CreateSharedStringItem(sharedStringTable, sharedString);
                }
                sharedStringTablePart.SharedStringTable = sharedStringTable;
                // Save the worksheet.
                newWorksheetPart.Worksheet.Save();

                // Link this worksheet to our workbook
                spreadSheet.WorkbookPart.Workbook.GetFirstChild <Sheets>().AppendChild(new Sheet()
                {
                    Id      = spreadSheet.WorkbookPart.GetIdOfPart(newWorksheetPart),
                    SheetId = 1,
                    Name    = "Table"
                });

                // Save the workbook.
                spreadSheet.WorkbookPart.Workbook.Save();
            }
            return(ms);
        }
        private void generateTaskDataWorksheet(WorksheetPart worksheetPart4)
        {
            foreach (KeyValuePair <string, userDetailsObject> person in reportData.people)
            {
                string displayName = person.Value.displayName;
                string userid      = person.Key;
                Console.WriteLine(displayName);
                Console.WriteLine(userid);
            }
            Worksheet worksheet4 = new Worksheet()
            {
                MCAttributes = new MarkupCompatibilityAttributes()
                {
                    Ignorable = "x14ac"
                }
            };

            worksheet4.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            worksheet4.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            worksheet4.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
            //worksheet4.AddNamespaceDeclaration("xr", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision");
            //worksheet4.AddNamespaceDeclaration("xr2", "http://schemas.microsoft.com/office/spreadsheetml/2015/revision2");
            //worksheet4.AddNamespaceDeclaration("xr3", "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3");
            //worksheet4.SetAttribute(new OpenXmlAttribute("xr", "uid", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision", genStrGuid()));
            SheetDimension sheetDimension4 = new SheetDimension()
            {
                Reference = "A1:J" + (reportData.tasks.value.Count + 1).ToString()
            };

            SheetViews sheetViews4 = new SheetViews();

            SheetView sheetView4 = new SheetView()
            {
                WorkbookViewId = (UInt32Value)0U
            };
            Selection selection2 = new Selection()
            {
                ActiveCell = "G23", SequenceOfReferences = new ListValue <StringValue>()
                {
                    InnerText = "G23"
                }
            };

            sheetView4.Append(selection2);

            sheetViews4.Append(sheetView4);
            SheetFormatProperties sheetFormatProperties4 = new SheetFormatProperties()
            {
                DefaultRowHeight = 15D, DyDescent = 0.25D
            };

            Columns columns4 = new Columns();
            Column  column18 = new Column()
            {
                Min = (UInt32Value)1U, Max = (UInt32Value)1U, Width = 26.85546875D, BestFit = true, CustomWidth = true
            };
            Column column19 = new Column()
            {
                Min = (UInt32Value)2U, Max = (UInt32Value)2U, Width = 12.85546875D, BestFit = true, CustomWidth = true
            };
            Column column20 = new Column()
            {
                Min = (UInt32Value)3U, Max = (UInt32Value)3U, Width = 34.42578125D, BestFit = true, CustomWidth = true
            };
            Column column21 = new Column()
            {
                Min = (UInt32Value)4U, Max = (UInt32Value)4U, Width = 21.7109375D, BestFit = true, CustomWidth = true
            };
            Column column22 = new Column()
            {
                Min = (UInt32Value)5U, Max = (UInt32Value)5U, Width = 11.140625D, BestFit = true, CustomWidth = true
            };
            Column column23 = new Column()
            {
                Min = (UInt32Value)6U, Max = (UInt32Value)6U, Width = 15.7109375D, BestFit = true, CustomWidth = true
            };
            Column column24 = new Column()
            {
                Min = (UInt32Value)7U, Max = (UInt32Value)7U, Width = 18D, BestFit = true, CustomWidth = true
            };
            Column column25 = new Column()
            {
                Min = (UInt32Value)8U, Max = (UInt32Value)8U, Width = 16D, BestFit = true, CustomWidth = true
            };
            Column column26 = new Column()
            {
                Min = (UInt32Value)9U, Max = (UInt32Value)9U, Width = 15.5703125D, BestFit = true, CustomWidth = true
            };
            Column column27 = new Column()
            {
                Min = (UInt32Value)10U, Max = (UInt32Value)10U, Width = 35.85546875D, BestFit = true, CustomWidth = true
            };

            columns4.Append(column18);
            columns4.Append(column19);
            columns4.Append(column20);
            columns4.Append(column21);
            columns4.Append(column22);
            columns4.Append(column23);
            columns4.Append(column24);
            columns4.Append(column25);
            columns4.Append(column26);
            columns4.Append(column27);

            SheetData sheetData4 = new SheetData();

            Row headerRow = new Row()
            {
                RowIndex = (UInt32Value)1U, Spans = new ListValue <StringValue>()
                {
                    InnerText = "1:10"
                }, DyDescent = 0.25D
            };

            for (int i = 1; i <= headers.Count; i++)
            {
                Console.WriteLine("Header value: {0} ", headers[i - 1]);
                Console.WriteLine("Header cell ref: {0} ", rowArry[i - 1].ToString() + "1");


                Cell cellHeader = new Cell()
                {
                    CellReference = rowArry[i - 1].ToString() + (1).ToString(), DataType = CellValues.InlineString
                };
                InlineString cellHeaderValue = new InlineString();

                cellHeaderValue.Text = new Text(headers[i - 1]);

                cellHeader.Append(cellHeaderValue);

                headerRow.Append(cellHeader);
            }

            sheetData4.Append(headerRow);

            for (int tIndex = 1; tIndex <= reportData.tasks.value.Count; tIndex++)
            {
                int  iCol = 0;
                uint iRow = (uint)tIndex + 1;

                Row dataRow = new Row()
                {
                    RowIndex = new UInt32Value((uint)iRow), Spans = new ListValue <StringValue>()
                    {
                        InnerText = "1:10"
                    }, DyDescent = 0.25D
                };

                taskObject task = reportData.tasks.value[tIndex - 1];

                Cell cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                //CellValue cellValue = new CellValue
                InlineString cellValue = new InlineString(new Text(task.title));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString();
                string userid = "";
                foreach (KeyValuePair <string, assignmentObject> pair in task.assignments)
                {
                    userid         = pair.Key;
                    cellValue.Text = new Text(reportData.people[pair.Key].displayName);
                    break;
                }

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                string email = " ";
                if (userid != "")
                {
                    email = reportData.people[userid].mail;
                }
                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString(new Text(email));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                string bucketName = "";
                foreach (bucketObject b in reportData.buckets)
                {
                    if (b.id == task.bucketId)
                    {
                        bucketName = b.name;
                    }
                }

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString(new Text(bucketName));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString();
                if (task.percentComplete == 0)
                {
                    cellValue.Text = new Text("Not started");
                }
                else
                {
                    cellValue.Text = new Text(progress[100 / task.percentComplete]);
                }

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString(new Text(getStringFromDate(task.dueDateTime)));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString(new Text(getStringFromDate(task.completedDateTime)));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                string completedByUser = "";
                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                if (task.completedBy != null)
                {
                    completedByUser = reportData.people[task.completedBy].displayName;
                }
                cellValue = new InlineString(new Text(completedByUser));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString(new Text(getStringFromDate(task.createdDateTime)));

                cellData.Append(cellValue);
                dataRow.Append(cellData);

                cellData = new Cell()
                {
                    CellReference = rowArry[iCol++].ToString() + (iRow).ToString(), DataType = CellValues.InlineString
                };
                cellValue = new InlineString(new Text(task.id));

                cellData.Append(cellValue);
                dataRow.Append(cellData);
                sheetData4.Append(dataRow);
                //Debugger.Break();
            }
            PageMargins pageMargins6 = new PageMargins()
            {
                Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D
            };
            PageSetup pageSetup6 = new PageSetup()
            {
                Orientation = OrientationValues.Portrait, Id = "rId1"
            };

            TableParts tableParts1 = new TableParts()
            {
                Count = (UInt32Value)1U
            };
            TablePart tablePart1 = new TablePart()
            {
                Id = "rId1"
            };

            tableParts1.Append(tablePart1);

            worksheet4.Append(sheetDimension4);
            worksheet4.Append(sheetViews4);
            worksheet4.Append(sheetFormatProperties4);
            worksheet4.Append(columns4);
            worksheet4.Append(sheetData4);
            worksheet4.Append(pageMargins6);
            worksheet4.Append(pageSetup6);
            worksheet4.Append(tableParts1);

            worksheetPart4.Worksheet = worksheet4;
        }
示例#29
0
        private void ExportBatch(DocumentBatchInfo batch, DataMapper mapper, MemoryStream stream, Utf8JsonWriter writer)
        {
            TablePart table = Document.TableParts.Where(t => t.Name == "Реализация").FirstOrDefault();

            if (table == null)
            {
                Console.WriteLine("Табличная часть \"Реализация\" не найдена.");
                return;
            }

            // InfoBase.ReferenceTypeCodes.TryGetValue()

            using (SqlConnection connection = new SqlConnection(GetMARSConnectionString()))
            {
                connection.Open();

                using (SqlCommand command1 = connection.CreateCommand())
                {
                    command1.CommandType = CommandType.Text;
                    //command1.CommandText = SelectDocuments_Script();
                    command1.CommandTimeout = 60; // seconds
                    mapper.ConfigureSelectCommand(command1);

                    //command1.Parameters.AddWithValue("Period1", batch.Period1);
                    //command1.Parameters.AddWithValue("Period2", batch.Period2);

                    using (SqlCommand command2 = connection.CreateCommand())
                    {
                        command2.CommandType    = CommandType.Text;
                        command2.CommandText    = SelectDocumentTablePart_Script(table);
                        command2.CommandTimeout = 600; // seconds

                        command2.Parameters.Add("Ref", SqlDbType.Binary, 16);

                        using (SqlDataReader reader1 = command1.ExecuteReader())
                        {
                            while (reader1.Read())
                            {
                                mapper.MapDataToJson(reader1, writer);
                                writer.Flush();

                                ReadOnlySpan <byte> span = new ReadOnlySpan <byte>(stream.GetBuffer(), 0, (int)writer.BytesCommitted);

                                writer.Reset();
                                stream.Position = 0;

                                Console.WriteLine(Encoding.UTF8.GetString(span));

                                //command2.Parameters["Ref"].Value = reader1["Ref"];

                                ////Console.WriteLine("Document = " + (new Guid(doc)).ToString());

                                //using (SqlDataReader reader2 = command2.ExecuteReader())
                                //{
                                //    while (reader2.Read())
                                //    {
                                //        for (int f = 0; f < reader2.FieldCount; f++)
                                //        {
                                //            Console.WriteLine(reader2.GetName(f) + " = " + reader2.GetValue(f).ToString());
                                //        }
                                //    }
                                //    reader2.Close();
                                //}
                            }
                            reader1.Close();
                        }
                    }
                }
            }
        }