/// <summary> /// Creates the content of the shet (columns, rows, cells) /// </summary> /// <param name="spreadsheetDocument">The spreadsheet containing the sheets</param> /// <param name="worksheetPart">The worksheetpart for this item</param> private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); } #region Excel headers string header1 = "TypeID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header2 = "Type"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue <CellValues>(CellValues.SharedString); #endregion int columnCount = 1; uint rowCount = 2; foreach (QAGroup qaGroups in _qaGroups.QAGroupsList) { if (columnCount >= 2) { columnCount = 1; } string text1 = qaGroups.TypeID; Cell cell1 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = qaGroups.Type; Cell cell2 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.String; columnCount++; rowCount++; } worksheetPart.Worksheet.Save(); }
/// <summary> /// Creates the content of the shet (columns, rows, cells) /// </summary> /// <param name="spreadsheetDocument">The spreadsheet containing the sheets</param> /// <param name="worksheetPart">The worksheetpart for this item</param> private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); } #region Excel headers const string header1 = "ID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header2 = "GroupIdentifier"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header3 = "GroupType"; int index3 = _sharedResources.InsertSharedStringItem(header3, shareStringPart); Cell headerCell3 = _sharedResources.InsertCellInWorksheet("C", 1, worksheetPart); headerCell3.CellValue = new CellValue(index3.ToString(CultureInfo.InvariantCulture)); headerCell3.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header4 = "GroupExpandable"; int index4 = _sharedResources.InsertSharedStringItem(header4, shareStringPart); Cell headerCell4 = _sharedResources.InsertCellInWorksheet("D", 1, worksheetPart); headerCell4.CellValue = new CellValue(index4.ToString(CultureInfo.InvariantCulture)); headerCell4.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header5 = "Name"; int index5 = _sharedResources.InsertSharedStringItem(header5, shareStringPart); Cell headerCell5 = _sharedResources.InsertCellInWorksheet("E", 1, worksheetPart); headerCell5.CellValue = new CellValue(index5.ToString(CultureInfo.InvariantCulture)); headerCell5.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header6 = "Expanded"; int index6 = _sharedResources.InsertSharedStringItem(header6, shareStringPart); Cell headerCell6 = _sharedResources.InsertCellInWorksheet("F", 1, worksheetPart); headerCell6.CellValue = new CellValue(index6.ToString(CultureInfo.InvariantCulture)); headerCell6.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header7 = "DataQualityScore"; int index7 = _sharedResources.InsertSharedStringItem(header7, shareStringPart); Cell headerCell7 = _sharedResources.InsertCellInWorksheet("G", 1, worksheetPart); headerCell7.CellValue = new CellValue(index7.ToString(CultureInfo.InvariantCulture)); headerCell7.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header8 = "RequiredScore"; int index8 = _sharedResources.InsertSharedStringItem(header8, shareStringPart); Cell headerCell8 = _sharedResources.InsertCellInWorksheet("H", 1, worksheetPart); headerCell8.CellValue = new CellValue(index8.ToString(CultureInfo.InvariantCulture)); headerCell8.DataType = new EnumValue <CellValues>(CellValues.SharedString); #endregion #region Insert original ktUIExaminedGroup items into excel int columnCount = 1; uint rowCount = 2; foreach (ktExaminedGroup exGroup in _examinedGroup.ExaminedGroupList) { if (columnCount >= 8) { columnCount = 1; } string text1 = exGroup.ID; Cell cell1 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = exGroup.GroupIdentifier; Cell cell2 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.String; columnCount++; string text3 = exGroup.GroupType; Cell cell3 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; columnCount++; string text4 = exGroup.GroupExpendable; Cell cell4 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell4.CellValue = new CellValue(text4.ToString(CultureInfo.InvariantCulture)); cell4.DataType = CellValues.Number; columnCount++; string text5 = exGroup.Name; Cell cell5 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell5.CellValue = new CellValue(text5.ToString(CultureInfo.InvariantCulture)); cell5.DataType = CellValues.String; columnCount++; string text6 = exGroup.Expanded; Cell cell6 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell6.CellValue = new CellValue(text6.ToString(CultureInfo.InvariantCulture)); cell6.DataType = CellValues.Number; columnCount++; string text7 = exGroup.DataQualityScore; Cell cell7 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell7.CellValue = new CellValue(text7.ToString(CultureInfo.InvariantCulture)); cell7.DataType = CellValues.Number; columnCount++; string text8 = exGroup.RequiredScore; Cell cell8 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell8.CellValue = new CellValue(text8.ToString(CultureInfo.InvariantCulture)); cell8.DataType = CellValues.Number; rowCount++; } #endregion #region Insert new ktUIExaminedGroup items into excel foreach (PageType page in _workspaceVm.PageList) { foreach (GroupTypeOrder gtOrder in page.GroupTypeOrders) { if (!_examinedGroup.ExaminedGroupList.Any(x => x.ID.Equals(gtOrder.GroupTypeID))) { if (columnCount >= 8) { columnCount = 1; } string text1 = gtOrder.GroupTypeID; Cell cell1 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = "NULL"; Cell cell2 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.String; columnCount++; string text3 = gtOrder.Group.ResourceType; Cell cell3 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; columnCount++; string text4 = "0"; Cell cell4 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell4.CellValue = new CellValue(text4.ToString(CultureInfo.InvariantCulture)); cell4.DataType = CellValues.Number; columnCount++; string text5 = "NULL"; Cell cell5 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell5.CellValue = new CellValue(text5.ToString(CultureInfo.InvariantCulture)); cell5.DataType = CellValues.String; columnCount++; string text6 = "1"; Cell cell6 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell6.CellValue = new CellValue(text6.ToString(CultureInfo.InvariantCulture)); cell6.DataType = CellValues.Number; columnCount++; string text7 = "0"; Cell cell7 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell7.CellValue = new CellValue(text7.ToString(CultureInfo.InvariantCulture)); cell7.DataType = CellValues.Number; columnCount++; string text8 = "0"; Cell cell8 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell8.CellValue = new CellValue(text8.ToString(CultureInfo.InvariantCulture)); cell8.DataType = CellValues.Number; rowCount++; } } } #endregion worksheetPart.Worksheet.Save(); }
/// <summary> /// Creates the content of the shet (columns, rows, cells) /// </summary> /// <param name="spreadsheetDocument">The spreadsheet containing the sheets</param> /// <param name="worksheetPart">The worksheetpart for this item</param> private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); } #region Excel headers string header1 = "DesignID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header2 = "GroupOrder"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header3 = "GroupTypeID"; int index3 = _sharedResources.InsertSharedStringItem(header3, shareStringPart); Cell headerCell3 = _sharedResources.InsertCellInWorksheet("C", 1, worksheetPart); headerCell3.CellValue = new CellValue(index3.ToString(CultureInfo.InvariantCulture)); headerCell3.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header4 = "PageTypeID"; int index4 = _sharedResources.InsertSharedStringItem(header4, shareStringPart); Cell headerCell4 = _sharedResources.InsertCellInWorksheet("D", 1, worksheetPart); headerCell4.CellValue = new CellValue(index4.ToString(CultureInfo.InvariantCulture)); headerCell4.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header5 = "IncludedTypeID"; int index5 = _sharedResources.InsertSharedStringItem(header5, shareStringPart); Cell headerCell5 = _sharedResources.InsertCellInWorksheet("E", 1, worksheetPart); headerCell5.CellValue = new CellValue(index5.ToString(CultureInfo.InvariantCulture)); headerCell5.DataType = new EnumValue <CellValues>(CellValues.SharedString); #endregion #region Create temporary list containing the groups needed to create the ktUIOrder excel sheet foreach (PageType page in _workspaceVm.PageList) { foreach (GroupTypeOrder group in page.GroupTypeOrders) { if (group.Group != null) { for (int i = 0; i < group.Group.ItemOrder.Count; i++) { if (!_tempList.Any(x => x.GroupTypeID == group.GroupTypeID)) { _tempList.Add(group); } } } } } #endregion #region insert the items from the temporary list into the ktUIOrder excel sheet int columnCount = 1; uint rowCount = 2; foreach (GroupTypeOrder group in _tempList) { for (int i = 0; i < group.Group.ItemOrder.Count; i++) { if (columnCount >= 4) { columnCount = 1; } string text1 = group.Group.ItemOrder[i].DesignID; Cell cell1 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; double text2 = group.Group.ItemOrder[i].ItemOrder; Cell cell2 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.DataType = CellValues.Number; cell2.CellValue = new CellValue(DoubleValue.FromDouble(text2)); columnCount++; string text3 = group.Group.ItemOrder[i].GroupTypeID; Cell cell3 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.Number; columnCount++; string text4 = "255"; //Dummy value - Not used for anything, but cannot be null Cell cell4 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell4.CellValue = new CellValue(text4); cell4.DataType = CellValues.Number; columnCount++; string text5 = group.Group.ItemOrder[i].IncludedTypeID; Cell cell5 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell5.CellValue = new CellValue(text5); cell5.DataType = CellValues.Number; rowCount++; } } #endregion worksheetPart.Worksheet.Save(); }
/// <summary> /// Creates the content of the shet (columns, rows, cells) /// </summary> /// <param name="spreadsheetDocument">The spreadsheet containing the sheets</param> /// <param name="worksheetPart">The worksheetpart for this item</param> private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); } #region Excel headers const string header1 = "DesignID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header2 = "DatabaseTableName"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header3 = "DatabaseFieldName"; int index3 = _sharedResources.InsertSharedStringItem(header3, shareStringPart); Cell headerCell3 = _sharedResources.InsertCellInWorksheet("C", 1, worksheetPart); headerCell3.CellValue = new CellValue(index3.ToString(CultureInfo.InvariantCulture)); headerCell3.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header4 = "CodeTableName"; int index4 = _sharedResources.InsertSharedStringItem(header4, shareStringPart); Cell headerCell4 = _sharedResources.InsertCellInWorksheet("D", 1, worksheetPart); headerCell4.CellValue = new CellValue(index4.ToString(CultureInfo.InvariantCulture)); headerCell4.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header5 = "ResxID"; int index5 = _sharedResources.InsertSharedStringItem(header5, shareStringPart); Cell headerCell5 = _sharedResources.InsertCellInWorksheet("E", 1, worksheetPart); headerCell5.CellValue = new CellValue(index5.ToString(CultureInfo.InvariantCulture)); headerCell5.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header6 = "ReadOnlyPolicyID"; int index6 = _sharedResources.InsertSharedStringItem(header6, shareStringPart); Cell headerCell6 = _sharedResources.InsertCellInWorksheet("F", 1, worksheetPart); headerCell6.CellValue = new CellValue(index6.ToString(CultureInfo.InvariantCulture)); headerCell6.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header7 = "InputDataTypeID"; int index7 = _sharedResources.InsertSharedStringItem(header7, shareStringPart); Cell headerCell7 = _sharedResources.InsertCellInWorksheet("G", 1, worksheetPart); headerCell7.CellValue = new CellValue(index7.ToString(CultureInfo.InvariantCulture)); headerCell7.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header8 = "MortyParameter"; int index8 = _sharedResources.InsertSharedStringItem(header8, shareStringPart); Cell headerCell8 = _sharedResources.InsertCellInWorksheet("H", 1, worksheetPart); headerCell8.CellValue = new CellValue(index8.ToString(CultureInfo.InvariantCulture)); headerCell8.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header9 = "RequiredID"; int index9 = _sharedResources.InsertSharedStringItem(header9, shareStringPart); Cell headerCell9 = _sharedResources.InsertCellInWorksheet("I", 1, worksheetPart); headerCell9.CellValue = new CellValue(index9.ToString(CultureInfo.InvariantCulture)); headerCell9.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header10 = "GUIUnitShortName"; int index10 = _sharedResources.InsertSharedStringItem(header10, shareStringPart); Cell headerCell10 = _sharedResources.InsertCellInWorksheet("J", 1, worksheetPart); headerCell10.CellValue = new CellValue(index10.ToString(CultureInfo.InvariantCulture)); headerCell10.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header11 = "DatabaseUnitName"; int index11 = _sharedResources.InsertSharedStringItem(header11, shareStringPart); Cell headerCell11 = _sharedResources.InsertCellInWorksheet("K", 1, worksheetPart); headerCell11.CellValue = new CellValue(index11.ToString(CultureInfo.InvariantCulture)); headerCell11.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header12 = "LabkaUnitName"; int index12 = _sharedResources.InsertSharedStringItem(header12, shareStringPart); Cell headerCell12 = _sharedResources.InsertCellInWorksheet("L", 1, worksheetPart); headerCell12.CellValue = new CellValue(index12.ToString(CultureInfo.InvariantCulture)); headerCell12.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header13 = "DatabaseToUIConversion"; int index13 = _sharedResources.InsertSharedStringItem(header13, shareStringPart); Cell headerCell13 = _sharedResources.InsertCellInWorksheet("M", 1, worksheetPart); headerCell13.CellValue = new CellValue(index13.ToString(CultureInfo.InvariantCulture)); headerCell13.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header14 = "DefaultValue"; int index14 = _sharedResources.InsertSharedStringItem(header14, shareStringPart); Cell headerCell14 = _sharedResources.InsertCellInWorksheet("N", 1, worksheetPart); headerCell14.CellValue = new CellValue(index14.ToString(CultureInfo.InvariantCulture)); headerCell14.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header15 = "NormalRangeMinimum"; int index15 = _sharedResources.InsertSharedStringItem(header15, shareStringPart); Cell headerCell15 = _sharedResources.InsertCellInWorksheet("O", 1, worksheetPart); headerCell15.CellValue = new CellValue(index15.ToString(CultureInfo.InvariantCulture)); headerCell15.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header16 = "NormalRangeMaximum"; int index16 = _sharedResources.InsertSharedStringItem(header16, shareStringPart); Cell headerCell16 = _sharedResources.InsertCellInWorksheet("P", 1, worksheetPart); headerCell16.CellValue = new CellValue(index16.ToString(CultureInfo.InvariantCulture)); headerCell16.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header17 = "RangeMinimun"; int index17 = _sharedResources.InsertSharedStringItem(header17, shareStringPart); Cell headerCell17 = _sharedResources.InsertCellInWorksheet("Q", 1, worksheetPart); headerCell17.CellValue = new CellValue(index17.ToString(CultureInfo.InvariantCulture)); headerCell17.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header18 = "RangeMaximum"; int index18 = _sharedResources.InsertSharedStringItem(header18, shareStringPart); Cell headerCell18 = _sharedResources.InsertCellInWorksheet("R", 1, worksheetPart); headerCell18.CellValue = new CellValue(index18.ToString(CultureInfo.InvariantCulture)); headerCell18.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header19 = "CopyEncounter"; int index19 = _sharedResources.InsertSharedStringItem(header19, shareStringPart); Cell headerCell19 = _sharedResources.InsertCellInWorksheet("S", 1, worksheetPart); headerCell19.CellValue = new CellValue(index19.ToString(CultureInfo.InvariantCulture)); headerCell19.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header20 = "CopyEpisode"; int index20 = _sharedResources.InsertSharedStringItem(header20, shareStringPart); Cell headerCell20 = _sharedResources.InsertCellInWorksheet("T", 1, worksheetPart); headerCell20.CellValue = new CellValue(index20.ToString(CultureInfo.InvariantCulture)); headerCell20.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header21 = "DataQualityScore"; int index21 = _sharedResources.InsertSharedStringItem(header21, shareStringPart); Cell headerCell21 = _sharedResources.InsertCellInWorksheet("U", 1, worksheetPart); headerCell21.CellValue = new CellValue(index21.ToString(CultureInfo.InvariantCulture)); headerCell21.DataType = new EnumValue <CellValues>(CellValues.SharedString); const string header22 = "CopyFinalEncounter"; int index22 = _sharedResources.InsertSharedStringItem(header22, shareStringPart); Cell headerCell22 = _sharedResources.InsertCellInWorksheet("V", 1, worksheetPart); headerCell22.CellValue = new CellValue(index22.ToString(CultureInfo.InvariantCulture)); headerCell22.DataType = new EnumValue <CellValues>(CellValues.SharedString); #endregion #region Insert original ktUIExaminedGroup items into excel int columnCount = 1; uint rowCount = 2; foreach (ktUIDesign uiDesign in _uiDesign.ktUIDesignList) { //if (columnCount >= 22) //{ columnCount = 1; //} string text1 = uiDesign.DesignID; Cell cell1 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = uiDesign.DatabaseTableName; Cell cell2 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.String; columnCount++; string text3 = uiDesign.DatabaseFieldName; Cell cell3 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; columnCount++; string text4 = uiDesign.CodeTableName; Cell cell4 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell4.CellValue = new CellValue(text4); cell4.DataType = CellValues.String; columnCount++; string text5 = uiDesign.ResxID; Cell cell5 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell5.CellValue = new CellValue(text5); cell5.DataType = CellValues.String; columnCount++; // string text6 = uiDesign.ReadOnlyPolicy; Cell cell6 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell6.CellValue = new CellValue(text6); cell6.DataType = CellValues.Number; columnCount++; string text7 = uiDesign.InputDataType; Cell cell7 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell7.CellValue = new CellValue(text7); cell7.DataType = CellValues.Number; columnCount++; string text8 = uiDesign.MortyParameter; Cell cell8 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell8.CellValue = new CellValue(text8); cell8.DataType = CellValues.Number; columnCount++; // string text9 = uiDesign.RequiredID; Cell cell9 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell9.CellValue = new CellValue(text9); cell9.DataType = CellValues.Number; columnCount++; string text10 = uiDesign.GUIUnitShortName; Cell cell10 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell10.CellValue = new CellValue(text10); cell10.DataType = CellValues.String; columnCount++; string text11 = uiDesign.DatabaseUnitName; Cell cell11 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell11.CellValue = new CellValue(text11); cell11.DataType = CellValues.String; columnCount++; string text12 = uiDesign.LabkaUnitName; Cell cell12 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell12.CellValue = new CellValue(text12); cell12.DataType = CellValues.String; columnCount++; string text13 = uiDesign.DatabaseToUIConversion; Cell cell13 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell13.CellValue = new CellValue(text13); cell13.DataType = text13 == "NULL" ? CellValues.String : CellValues.Number; columnCount++; string text14 = uiDesign.DefaultValue; Cell cell14 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell14.CellValue = new CellValue(text14); cell14.DataType = text14 == "NULL" ? CellValues.String : CellValues.Number; columnCount++; // string text15 = uiDesign.NormalRangeMinimum; Cell cell15 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell15.CellValue = new CellValue(text15); cell15.DataType = text15 == "NULL" ? CellValues.String : CellValues.Number; columnCount++; string text16 = uiDesign.NormalRangeMaximum; Cell cell16 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell16.CellValue = new CellValue(text16); cell16.DataType = text16 == "NULL" ? CellValues.String : CellValues.Number; columnCount++; string text17 = uiDesign.RangeMinimum ?? "NULL"; Cell cell17 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell17.CellValue = new CellValue(text17); cell17.DataType = text17 == "NULL" ? CellValues.String : CellValues.Number; columnCount++; // string text18 = uiDesign.RangeMaximum ?? "NULL"; Cell cell18 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell18.CellValue = new CellValue(text18); cell18.DataType = text18 == "NULL" ? CellValues.String : CellValues.Number; columnCount++; string text19 = uiDesign.CopyEncounter; Cell cell19 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell19.CellValue = new CellValue(text19); cell19.DataType = CellValues.Number; columnCount++; string text20 = uiDesign.CopyEpisode; Cell cell20 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell20.CellValue = new CellValue(text20); cell20.DataType = CellValues.Number; columnCount++; string text21 = uiDesign.DataQualityScore; Cell cell21 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell21.CellValue = new CellValue(text21); cell21.DataType = CellValues.Number; columnCount++; string text22 = uiDesign.CopyFinalEncounter; Cell cell22 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell22.CellValue = new CellValue(text22); cell22.DataType = CellValues.Number; columnCount++; rowCount++; } #endregion worksheetPart.Worksheet.Save(); }
/// <summary> /// Creates the content of the shet (columns, rows, cells) /// </summary> /// <param name="spreadsheetDocument">The spreadsheet containing the sheets</param> /// <param name="worksheetPart">The worksheetpart for this item</param> private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); } #region Excel headers string header1 = "LanguageID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header2 = "ResourceID"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header3 = "TranslationText"; int index3 = _sharedResources.InsertSharedStringItem(header3, shareStringPart); Cell headerCell3 = _sharedResources.InsertCellInWorksheet("C", 1, worksheetPart); headerCell3.CellValue = new CellValue(index3.ToString(CultureInfo.InvariantCulture)); headerCell3.DataType = new EnumValue <CellValues>(CellValues.SharedString); #endregion int columnCount = 1; uint rowCount = 2; #region Create list containing all the resource translations, but also the ResourceTypeID from ktResources var query = (from a in _rTranslation.ktResourceTranslationList join b in _resources.ktResourceList on a.ResourceID equals b.ResourceID select new { a.TranslationText, a.LanguageID, a.ResourceID, b.ResourceTypeID }).ToList(); #endregion #region Create temporary list containing the groups needed to create the ktUIOrder excel sheet foreach (PageType page in _workspaceVM.PageList) { foreach (GroupTypeOrder group in page.GroupTypeOrders) { if (group.GroupTypeID.Equals("58") || group.GroupTypeID.Equals("60")) { continue; } if (!_tempList.Any(x => x.GroupTypeID.Equals(group.GroupTypeID))) { _tempList.Add(group); } } } #endregion #region Inserting data rows //Insert all from the original list + changes --> renaming of groups foreach (var qItem in query) { if (qItem.ResourceTypeID.Equals("1")) { //Indsætter alle de grupper der ikke indgår i templisten under ResourceTypeID 1 if (!_tempList.Any(x => x.Group.ResourceID.Equals(qItem.ResourceID))) { if (columnCount >= 3) { columnCount = 1; } string text9 = qItem.LanguageID; Cell cell9 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell9.CellValue = new CellValue(text9); cell9.DataType = CellValues.Number; columnCount++; string text10 = qItem.ResourceID; Cell cell10 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell10.CellValue = new CellValue(text10); cell10.DataType = CellValues.Number; columnCount++; string text11 = qItem.TranslationText; Cell cell11 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell11.CellValue = new CellValue(text11); cell11.DataType = CellValues.String; rowCount++; } //Indsætter de groups der er i templisten else { var gtOrder = (from a in _tempList where a.Group.ResourceID.Equals(qItem.ResourceID) select a).FirstOrDefault(); if (columnCount >= 3) { columnCount = 1; } string text1 = qItem.LanguageID; Cell cell1 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = gtOrder.Group.ResourceID; Cell cell2 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.Number; columnCount++; string text3 = qItem.LanguageID.Equals("1") ? gtOrder.Group.EnglishTranslationText : gtOrder.Group.DanishTranslationText; Cell cell3 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; rowCount++; } } //Indsætter alle de andre translation informationer else { if (columnCount >= 3) { columnCount = 1; } string text7 = qItem.LanguageID; Cell cell7 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell7.CellValue = new CellValue(text7); cell7.DataType = CellValues.Number; columnCount++; string text8 = qItem.ResourceID; Cell cell8 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell8.CellValue = new CellValue(text8); cell8.DataType = CellValues.Number; columnCount++; string text9 = qItem.TranslationText; Cell cell9 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell9.CellValue = new CellValue(text9); cell9.DataType = CellValues.String; rowCount++; } } //Indsætter de groups der ikke indgår in den originale liste --> Ny oprettede grupper foreach (var order in _tempList) { if (!query.Any(x => x.ResourceID.Equals(order.Group.ResourceID))) { for (int i = 1; i < 3; i++) { if (columnCount >= 3) { columnCount = 1; } string text1 = i.ToString(); Cell cell1 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = order.Group.ResourceID; Cell cell2 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.Number; columnCount++; string text3 = text1.Equals("1") ? order.Group.EnglishTranslationText : order.Group.DanishTranslationText; Cell cell3 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; rowCount++; } } } #endregion //Saves the excel sheet worksheetPart.Worksheet.Save(); }
/// <summary> /// Creates the content of the shet (columns, rows, cells) /// </summary> /// <param name="spreadsheetDocument">The spreadsheet containing the sheets</param> /// <param name="worksheetPart">The worksheetpart for this item</param> private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>(); } #region Excel headers const string header1 = "DepartmentID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue<CellValues>(CellValues.SharedString); const string header2 = "PageTypeID"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue<CellValues>(CellValues.SharedString); const string header3 = "GroupTypeID"; int index3 = _sharedResources.InsertSharedStringItem(header3, shareStringPart); Cell headerCell3 = _sharedResources.InsertCellInWorksheet("C", 1, worksheetPart); headerCell3.CellValue = new CellValue(index3.ToString(CultureInfo.InvariantCulture)); headerCell3.DataType = new EnumValue<CellValues>(CellValues.SharedString); const string header4 = "GroupOrder"; int index4 = _sharedResources.InsertSharedStringItem(header4, shareStringPart); Cell headerCell4 = _sharedResources.InsertCellInWorksheet("D", 1, worksheetPart); headerCell4.CellValue = new CellValue(index4.ToString(CultureInfo.InvariantCulture)); headerCell4.DataType = new EnumValue<CellValues>(CellValues.SharedString); #endregion #region Insert columns and rows int columnCount = 1; uint rowCount = 2; //_pages = _workspaceVm.PageList; //_orders = _groupOrder.ktUIGroupOrderList; //foreach (ktUIGroupOrder order in _orders) //{ // if (columnCount >= 4) // { // columnCount = 1; // } // string text1 = order.DepartmentID; // Cell cell1 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell1.CellValue = new CellValue(text1); // cell1.DataType = CellValues.Number; // columnCount++; // string text2 = order.PageTypeID; // Cell cell2 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell2.CellValue = new CellValue(text2); // cell2.DataType = CellValues.Number; // columnCount++; // string text3 = order.GroupTypeID; // Cell cell3 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell3.CellValue = new CellValue(text3); // cell3.DataType = CellValues.Number; // columnCount++; // double text4 = Convert.ToDouble(order.GroupOrder); // Cell cell4 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell4.CellValue = new CellValue(text4.ToString(CultureInfo.InvariantCulture)); // cell4.DataType = CellValues.Number; // rowCount++; //} //foreach (PageType page in _pages) //{ // foreach (GroupTypeOrder gtOrder in page.Groups) // { // if (_orders.Any(x => x.GroupTypeID != gtOrder.GroupTypeID)) // { // if (columnCount >= 4) // { // columnCount = 1; // } // string text1 = gtOrder.DepartmentID; //order.DepartmentID; // Cell cell1 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell1.CellValue = new CellValue(text1); // cell1.DataType = CellValues.Number; // columnCount++; // string text2 = gtOrder.PageTypeID; //order.PageTypeID; // Cell cell2 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell2.CellValue = new CellValue(text2); // cell2.DataType = CellValues.Number; // columnCount++; // string text3 = gtOrder.GroupTypeID; //order.GroupTypeID; // Cell cell3 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell3.CellValue = new CellValue(text3); // cell3.DataType = CellValues.Number; // columnCount++; // double text4 = Convert.ToDouble(gtOrder.GroupOrder); //Convert.ToDouble(order.GroupOrder); // Cell cell4 = // _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), // rowCount, worksheetPart); // cell4.CellValue = new CellValue(text4.ToString(CultureInfo.InvariantCulture)); // cell4.DataType = CellValues.Number; // rowCount++; // } // } //} foreach (PageType page in _workspaceVm.PageList) { foreach (GroupTypeOrder group in page.GroupTypeOrders) { if (columnCount >= 4) { columnCount = 1; } string text1 = group.DepartmentID; Cell cell1 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = page.PageTypeID; Cell cell2 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.Number; columnCount++; string text3 = group.GroupTypeID; Cell cell3 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.Number; columnCount++; double text4 = Convert.ToDouble(group.GroupOrder); Cell cell4 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell4.CellValue = new CellValue(text4.ToString(CultureInfo.InvariantCulture)); cell4.DataType = CellValues.Number; rowCount++; } } #endregion worksheetPart.Worksheet.Save(); }
private void InsertTextIntoCells(SpreadsheetDocument spreadsheetDocument, WorksheetPart worksheetPart) { // Get the SharedStringTablePart. If it does not exist, create a new one. SharedStringTablePart shareStringPart; if (spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().Any()) { shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType <SharedStringTablePart>().First(); } else { shareStringPart = spreadsheetDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); } #region Excel headers string header1 = "ResourceID"; int index1 = _sharedResources.InsertSharedStringItem(header1, shareStringPart); Cell headerCell1 = _sharedResources.InsertCellInWorksheet("A", 1, worksheetPart); headerCell1.CellValue = new CellValue(index1.ToString(CultureInfo.InvariantCulture)); headerCell1.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header2 = "ResourceTypeID"; int index2 = _sharedResources.InsertSharedStringItem(header2, shareStringPart); Cell headerCell2 = _sharedResources.InsertCellInWorksheet("B", 1, worksheetPart); headerCell2.CellValue = new CellValue(index2.ToString(CultureInfo.InvariantCulture)); headerCell2.DataType = new EnumValue <CellValues>(CellValues.SharedString); string header3 = "ResourceResxID"; int index3 = _sharedResources.InsertSharedStringItem(header3, shareStringPart); Cell headerCell3 = _sharedResources.InsertCellInWorksheet("C", 1, worksheetPart); headerCell3.CellValue = new CellValue(index3.ToString(CultureInfo.InvariantCulture)); headerCell3.DataType = new EnumValue <CellValues>(CellValues.SharedString); #endregion #region Insert ktResources into the excel document int columnCount = 1; uint rowCount = 2; foreach (ktResources resource in _resources.ktResourceList) { if (columnCount >= 3) { columnCount = 1; } string text1 = resource.ResourceID; Cell cell1 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = resource.ResourceTypeID; Cell cell2 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.Number; columnCount++; string text3 = resource.ResourceResxID; Cell cell3 = _sharedResources.InsertCellInWorksheet(_sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; rowCount++; } #endregion #region Insert new ktResource items into excel foreach (PageType page in _workspaceVM.PageList) { foreach (GroupTypeOrder gtOrder in page.GroupTypeOrders) { if (gtOrder.GroupTypeID.Equals("58") || gtOrder.GroupTypeID.Equals("60")) { break; } if (!_resources.ktResourceList.Any(x => x.ResourceResxID.Equals(gtOrder.Group.ResourceType))) { if (columnCount >= 3) { columnCount = 1; } string text1 = gtOrder.Group.ResourceID; Cell cell1 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell1.CellValue = new CellValue(text1); cell1.DataType = CellValues.Number; columnCount++; string text2 = gtOrder.Group.ResourceTypeID; Cell cell2 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell2.CellValue = new CellValue(text2); cell2.DataType = CellValues.Number; columnCount++; string text3 = gtOrder.Group.ResourceType; Cell cell3 = _sharedResources.InsertCellInWorksheet( _sharedResources.Number2String(columnCount, true), rowCount, worksheetPart); cell3.CellValue = new CellValue(text3); cell3.DataType = CellValues.String; rowCount++; } } } #endregion worksheetPart.Worksheet.Save(); }