本文整理汇总了C#中IXLWorksheet.Column方法的典型用法代码示例。如果您正苦于以下问题:C# IXLWorksheet.Column方法的具体用法?C# IXLWorksheet.Column怎么用?C# IXLWorksheet.Column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXLWorksheet
的用法示例。
在下文中一共展示了IXLWorksheet.Column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeHeaders
private void MakeHeaders(IXLWorksheet sheet, TestSuite suite)
{
int column = 1;
for (; column <= deep; column++)
{
string header = string.Empty;
for (int i = 1; i < column; i++)
header += "Sub-";
sheet.Cell(row, column).Value = header + "Category";
sheet.Column(column).Width = 20.86;
}
sheet.Cell(row, deep + 1).Value = "Name";
sheet.Column(deep + 1).Width = 30;
sheet.Cell(row, deep + 2).Value = "Id";
sheet.Column(deep + 2).Width = 13;
sheet.Cell(row, deep + 3).Value = "Summary";
sheet.Column(deep + 3).Width = 42;
sheet.Cell(row, deep + 4).Value = "Preconditions";
sheet.Column(deep + 4).Width = 56.43;
sheet.Cell(row, deep + 5).Value = "Actions";
sheet.Column(deep + 5).Width = 100;
sheet.Cell(row, deep + 6).Value = "Expected Results";
sheet.Column(deep + 6).Width = 100;
row++;
}
示例2: SetSystemsPhasesHeader
private static void SetSystemsPhasesHeader(IXLWorksheet ws)
{
var startColumnFirstSystemOrig = 6;
var startColumnFirstSystemCalc = 12;
var countPhases = 5;
var startColumnSecondSystemOrig = 22;
var startColumnSecondSystemCalc = 28;
var firstSystemPhasesCount = Model.FirstSystem.Phases.Count;
var secondSystemPhasesCount = Model.SecondSystem.Phases.Count;
var countToInsert = secondSystemPhasesCount - countPhases;
if (countToInsert > 0)
{
ws.Column(startColumnSecondSystemCalc).InsertColumnsAfter(countToInsert);
ws.Range(7, startColumnSecondSystemCalc, 8, startColumnSecondSystemCalc + countToInsert + countPhases - 1).Merge();
ws.Column(startColumnSecondSystemOrig).InsertColumnsAfter(countToInsert);
ws.Range(7, startColumnSecondSystemOrig, 8, startColumnSecondSystemOrig + countToInsert + countPhases - 1).Merge();
ws.Range(5, 20, 6, 35 + countToInsert + countToInsert).Merge();
}
countToInsert = firstSystemPhasesCount - countPhases;
if (countToInsert > 0)
{
ws.Column(startColumnFirstSystemCalc).InsertColumnsAfter(countToInsert);
ws.Range(7, startColumnFirstSystemCalc, 8, startColumnFirstSystemCalc + countToInsert + countPhases - 1).Merge();
ws.Column(startColumnFirstSystemOrig).InsertColumnsAfter(countToInsert);
ws.Range(7, startColumnFirstSystemOrig, 8, startColumnFirstSystemOrig + countToInsert + countPhases - 1).Merge();
ws.Range(5, 2, 6, 19 + countToInsert + countToInsert).Merge();
}
var firstSystemPhases = Model.FirstSystem.Phases.Select(x => x.Formula);
var secondSystemPhases = Model.SecondSystem.Phases.Select(x => x.Formula);
var currentCol = 6;
foreach (var phase in firstSystemPhases)
{
SetChemicalFormula(ws.Cell(9, currentCol).RichText, phase);
currentCol++;
}
currentCol++;
foreach (var phase in firstSystemPhases)
{
SetChemicalFormula(ws.Cell(9, currentCol).RichText, phase);
currentCol++;
}
currentCol += 5;
foreach (var phase in secondSystemPhases)
{
SetChemicalFormula(ws.Cell(9, currentCol).RichText, phase);
currentCol++;
}
currentCol++;
foreach (var phase in secondSystemPhases)
{
SetChemicalFormula(ws.Cell(9, currentCol).RichText, phase);
currentCol++;
}
}
示例3: SetOxidesTable
private static void SetOxidesTable(IXLWorksheet ws)
{
var mainOxides = Model.OxidesResultModel.First().OxidesResult.Select(x => x.Oxide.Formula);
var oxides = Model.Oxides.Where(x => !mainOxides.Contains(x.Composition.Formula));
var countInsert = oxides.Count() - 3;
if (countInsert > 0)
{
ws.Column("AV").InsertColumnsAfter(oxides.Count() - 3);//44 - 51 template column
ws.Range(5, 44, 8, 51 + countInsert).Merge();
ws.Range(18, 44, 18, 50 + countInsert).Merge();
}
var currentCol = 48;
foreach (var oxide in oxides)
{
var currentCell = ws.Cell(9, currentCol);
currentCell.Style.Border.RightBorder = XLBorderStyleValues.Thin;
currentCell.Style.Border.LeftBorder = XLBorderStyleValues.Thin;
SetChemicalFormula(currentCell.RichText, oxide.Composition.Formula);
var currentResCell = ws.Cell(19, currentCol);
SetChemicalFormula(currentResCell.RichText, oxide.Composition.Formula);
currentCol++;
}
}
示例4: RemoveColumn
public void RemoveColumn(string sheetName, int colNum)
{
worksheet = workbook.Worksheet(sheetName);
worksheet.Column(colNum).Delete();
Save();
}
示例5: ConfigureCell
public void ConfigureCell(IXLWorksheet worksheet, SurveyType surveyType)
{
#region SetUp
int numberOfCells = 0;
int detailColumns = 1; // Inicialized in one because the last column
switch (surveyType)
{
case SurveyType.CareTeam:
detailColumns += 5;
numberOfCells = QuestionKey.CareTeamSurvey.NumberOfKeys() + detailColumns;
break;
case SurveyType.PCP:
detailColumns += 7;
numberOfCells = QuestionKey.PCPSurvey.NumberOfKeys() + detailColumns;
break;
case SurveyType.Specialist:
detailColumns += 7;
numberOfCells = QuestionKey.SpecialistSurvey.NumberOfKeys() + detailColumns;
break;
}
#endregion
#region Headers
for (int x = 1; x <= numberOfCells; x++)
{
worksheet.Cell(1, x).Style.Font.Bold = true;
worksheet.Cell(1, x).Style.Alignment.WrapText = true;
worksheet.Cell(1, x).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
worksheet.Cell(1, x).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
worksheet.Cell(1, x).Style.Fill.BackgroundColor = XLColor.LightCyan;
worksheet.Cell(1, x).Style.Font.FontSize = 11;
worksheet.Cell(1, x).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
worksheet.Cell(1, x).Style.Border.LeftBorder = XLBorderStyleValues.Thin;
worksheet.Cell(1, x).Style.Border.TopBorder = XLBorderStyleValues.Thin;
worksheet.Cell(1, x).Style.Border.RightBorder = XLBorderStyleValues.Thin;
if (x > detailColumns)
{
if (x == numberOfCells)
worksheet.Column(x).Width = 55;
else
worksheet.Column(x).Width = 30;
}
else
worksheet.Column(x).Width = 20;
}
#endregion
#region Rows
for (int x = 1; x <= numberOfCells; x++)
{
worksheet.Cell(2, x).Style.Alignment.WrapText = true;
worksheet.Cell(2, x).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
worksheet.Cell(2, x).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
worksheet.Cell(2, x).Style.Font.FontSize = 11;
worksheet.Cell(2, x).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
worksheet.Cell(2, x).Style.Border.LeftBorder = XLBorderStyleValues.Thin;
worksheet.Cell(2, x).Style.Border.TopBorder = XLBorderStyleValues.Thin;
worksheet.Cell(2, x).Style.Border.RightBorder = XLBorderStyleValues.Thin;
}
#endregion
}
示例6: createAllDataWorkheet
private void createAllDataWorkheet(IXLWorksheet worksheet)
{
worksheet.Column("A").Width = 30;
worksheet.Column("B").Width = 30;
worksheet.Column("C").Width = 30;
worksheet.Cell(1, 1).Value = "DATE";
addRightBottomBorder(worksheet.Cell(1, 1));
worksheet.Cell(1, 2).Value = "TIME";
addRightBottomBorder(worksheet.Cell(1, 2));
worksheet.Cell(1, 3).Value = "LAeq";
addRightBottomBorder(worksheet.Cell(1, 3));
worksheet.Cell(1, 4).Value = "LAMax";
addRightBottomBorder(worksheet.Cell(1, 4));
worksheet.Cell(1, 5).Value = "LAMin";
addRightBottomBorder(worksheet.Cell(1, 5));
worksheet.Cell(1, 6).Value = "LZMax";
addRightBottomBorder(worksheet.Cell(1, 6));
worksheet.Cell(1, 7).Value = "LZMin";
addRightBottomBorder(worksheet.Cell(1, 7));
int col = 8;
Type oneThird = typeof(ReadingData.OctaveBandOneThird);
foreach (var propertyInfo in oneThird.GetProperties())
{
worksheet.Cell(1, col).Value = "1/3 " + propertyInfo.Name.Replace("_", ".").Replace("Hz", "") + " Hz";
addRightBottomBorder(worksheet.Cell(1, col));
col++;
}
Type oneOne = typeof(ReadingData.OctaveBandOneOne);
foreach (var propertyInfo in oneOne.GetProperties())
{
worksheet.Cell(1, col).Value = "1/1 " + propertyInfo.Name.Replace("_", ".").Replace("Hz", "") + " Hz";
addRightBottomBorder(worksheet.Cell(1, col));
col++;
}
int index = 2;
foreach (var r in readings.OrderBy(x => x.Time))
{
worksheet.Cell(index, 1).Value = r.Time.ToString("dd/MM/yyyy");
addRightBottomBorder(worksheet.Cell(index, 1));
worksheet.Cell(index, 2).Value = r.Time.ToString("HH:mm");
addRightBottomBorder(worksheet.Cell(index, 2));
worksheet.Cell(index, 3).Value = oneDig(r.Data.LAeq);
addRightBottomBorder(worksheet.Cell(index, 3));
worksheet.Cell(index, 4).Value = oneDig(r.Data.LAMax);
addRightBottomBorder(worksheet.Cell(index, 4));
worksheet.Cell(index, 5).Value = oneDig(r.Data.LAMin);
addRightBottomBorder(worksheet.Cell(index, 5));
worksheet.Cell(index, 6).Value = oneDig(r.Data.LZMax);
addRightBottomBorder(worksheet.Cell(index, 6));
worksheet.Cell(index, 7).Value = oneDig(r.Data.LZMin);
addRightBottomBorder(worksheet.Cell(index, 7));
col = 8;
foreach (var propertyInfo in oneThird.GetProperties())
{
worksheet.Cell(index, col).Value = oneDig((Double)propertyInfo.GetValue(r.Data.LAeqOctaveBandOneThird));
addRightBottomBorder(worksheet.Cell(index, col));
col++;
}
foreach (var propertyInfo in oneOne.GetProperties())
{
worksheet.Cell(index, col).Value = oneDig((Double)propertyInfo.GetValue(r.Data.LAeqOctaveBandOneOne));
addRightBottomBorder(worksheet.Cell(index, col));
col++;
}
index++;
}
}
示例7: createCoverWorksheet
private void createCoverWorksheet(IXLWorksheet worksheet)
{
worksheet.Column("A").Width = 21;
worksheet.Column("B").Width = 26;
worksheet.Cell("A1").Value = "AUDIOVIEW EXPORT";
worksheet.Range("A1","B1").Merge();
addBottomBorder(worksheet.Cell("A1"));
addBottomBorder(worksheet.Cell("B1"));
worksheet.Cell("A2").Value = "PROJECT NAME";
addRightBottomBorder(worksheet.Cell("A2"));
worksheet.Cell("B2").Value = project.Name;
addBottomBorder(worksheet.Cell("B2"));
worksheet.Cell("A3").Value = "PROJECT NUMBER";
addRightBottomBorder(worksheet.Cell("A3"));
worksheet.Cell("B3").Value = project.Number;
addBottomBorder(worksheet.Cell("B3"));
worksheet.Cell("A4").Value = "DATE";
addRightBottomBorder(worksheet.Cell("A4"));
worksheet.Cell("B4").Value = project.Created.ToString();
addBottomBorder(worksheet.Cell("B4"));
worksheet.Cell("A5").Value = "MINOR INTERVAL PERIOD";
addRightBottomBorder(worksheet.Cell("A5"));
worksheet.Cell("B5").Value = project.MinorInterval.ToString();
addBottomBorder(worksheet.Cell("B5"));
worksheet.Cell("A6").Value = "MINOR INTERVAL LIMIT";
addRightBottomBorder(worksheet.Cell("A6"));
worksheet.Cell("B6").Value = project.MinorDBLimit;
addBottomBorder(worksheet.Cell("B6"));
worksheet.Cell("A7").Value = "MAJOR INTERVAL PERIOD";
addRightBottomBorder(worksheet.Cell("A7"));
worksheet.Cell("B7").Value = project.MajorInterval.ToString();
addBottomBorder(worksheet.Cell("B7"));
worksheet.Cell("A8").Value = "MAJOR INTERVAL LIMIT";
addRightBottomBorder(worksheet.Cell("A8"));
worksheet.Cell("B8").Value = project.MajorDBLimit;
addBottomBorder(worksheet.Cell("B8"));
}
示例8: createMinorIntervalWorkheet
private void createMinorIntervalWorkheet(IXLWorksheet worksheet)
{
worksheet.Column("A").Width = 30;
worksheet.Column("B").Width = 30;
worksheet.Column("C").Width = 30;
worksheet.Cell("A1").Value = "DATE";
addRightBottomBorder(worksheet.Cell("A1"));
worksheet.Cell("B1").Value = "TIME";
addRightBottomBorder(worksheet.Cell("B1"));
worksheet.Cell("C1").Value = "dB LAeq, xx min";
addBottomBorder(worksheet.Cell("C1"));
int index = 1;
foreach (var r in readings.Where(x=>!x.Major).OrderBy(x=>x.Time))
{
index++;
worksheet.Cell("A" + index).Value = r.Time.ToString("dd/MM/yy");
addRightBottomBorder(worksheet.Cell("A" + index));
worksheet.Cell("B" + index).Value = r.Time.ToString("HH:mm");
addRightBottomBorder(worksheet.Cell("B" + index));
worksheet.Cell("C" + index).Value = Math.Round(r.Data.LAeq, 1).ToString();
addBottomBorder(worksheet.Cell("C" + index));
}
}
示例9: BuildTextPageTop
// 构造表格标题和标题行
int BuildTextPageTop(PrintOption option,
Hashtable macro_table,
StreamWriter sw,
// ref ExcelDocument doc
IXLWorksheet sheet
)
{
// 表格标题
string strTableTitleText = option.TableTitle;
if (String.IsNullOrEmpty(strTableTitleText) == false)
{
strTableTitleText = StringUtil.MacroString(macro_table,
strTableTitleText);
if (sw != null)
{
sw.WriteLine(strTableTitleText);
sw.WriteLine("");
}
if (sheet != null)
{
#if NO
doc.WriteExcelTitle(0,
option.Columns.Count, // nTitleCols,
strTableTitleText,
6);
#endif
var header = sheet.Range(1, 1,
1, option.Columns.Count).Merge();
header.Value = strTableTitleText;
header.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// header.Style.Font.FontName = "微软雅黑";
header.Style.Font.Bold = true;
header.Style.Font.FontSize = 16;
}
}
string strColumnTitleLine = "";
List<int> widths = new List<int>();
for (int i = 0; i < option.Columns.Count; i++)
{
Column column = option.Columns[i];
widths.Add(column.WidthChars);
string strCaption = column.Caption;
// 如果没有caption定义,就挪用name定义
if (String.IsNullOrEmpty(strCaption) == true)
strCaption = column.Name;
// string strClass = Global.GetLeft(column.Name);
if (i != 0)
strColumnTitleLine += "\t";
strColumnTitleLine += strCaption;
if (sheet != null)
{
#if NO
doc.WriteExcelCell(
2,
i,
strCaption,
true);
#endif
var cell = sheet.Cell(2+1, i+1);
cell.Value = strCaption;
// cell.Style.Font.FontName = "微软雅黑";
cell.Style.Font.Bold = true;
if (column.WidthChars != -1)
sheet.Column(i + 1).Width = column.WidthChars;
}
}
if (sw != null)
sw.WriteLine(strColumnTitleLine);
#if NO
if (doc != null)
SetColumnWidth(doc, widths);
#endif
return 0;
}
示例10: CreateVerticalNumberHeader
private void CreateVerticalNumberHeader(IXLWorksheet workSheet, string HeadLineText,
int LineNumber, int StartColumnIndex)
{
workSheet.Cell(LineNumber, StartColumnIndex).Style
.Font.SetBold()
.Font.SetFontSize(9)
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left)
.Alignment.SetTextRotation(90);
workSheet.Cell(LineNumber, StartColumnIndex).Style
.Alignment.WrapText = true;
workSheet.Cell(LineNumber, StartColumnIndex).Value = HeadLineText;
workSheet.Row(LineNumber).Height = 75;
workSheet.Column(StartColumnIndex).Width = 4;
}
示例11: WriteOutNumberOfEntriesPerOrtsTeil
public int WriteOutNumberOfEntriesPerOrtsTeil(IXLWorksheet workSheet,
StatistikRootClass.DistributionCountTyp DistTyp)
{
IXLRange headerRng = workSheet.Range("B2:F2").Merge();
headerRng.Style
.Font.SetBold()
.Fill.SetBackgroundColor(XLColor.AliceBlue)
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
.Alignment.WrapText = true;
headerRng.Value = "Vorschläge / Ideen Anzahlen " + DistTyp.GetDescription();
switch (DistTyp)
{
case StatistikRootClass.DistributionCountTyp.AllTogether:
{
workSheet.Column("A").Width = 2;
workSheet.Column("G").Width = 2;
IXLRange CounterHeaderRange = workSheet.Range("E4:F4").Merge().SetDataType(XLCellValues.Text);
CounterHeaderRange.Value = "Anzahlen";
CounterHeaderRange.Style
.Font.SetBold()
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
.Alignment.WrapText = true;
int ColumnNumber = 0;
foreach (string Col in ProjektCounterColumns(DistTyp))
workSheet.Cell($"{ColumnNameTable[ColumnNumber++ + 1]}5").Value = Col;
workSheet.Column("D").Width = 40;
return 7;
}
break;
case StatistikRootClass.DistributionCountTyp.PerAG:
{
workSheet.Column("A").Width = 2;
workSheet.Column("G").Width = 2;
IXLRange CounterHeaderRange = workSheet.Range("E4:F4").Merge().SetDataType(XLCellValues.Text);
CounterHeaderRange.Value = "Anzahlen";
CounterHeaderRange.Style
.Font.SetBold()
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
.Alignment.WrapText = true;
int ColumnNumber = 0;
foreach (string Col in ProjektCounterColumns(DistTyp))
workSheet.Cell($"{ColumnNameTable[ColumnNumber++ + 1]}5").Value = Col;
workSheet.Column("D").Width = 40;
return 7;
}
break;
case StatistikRootClass.DistributionCountTyp.PerOrtsTeil:
{
workSheet.Column("A").Width = 2;
workSheet.Column("G").Width = 2;
IXLRange CounterHeaderRange = workSheet.Range("E4:F4").Merge().SetDataType(XLCellValues.Text);
CounterHeaderRange.Value = "Anzahlen";
CounterHeaderRange.Style
.Font.SetBold()
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
.Alignment.WrapText = true;
int ColumnNumber = 0;
foreach (string Col in ProjektCounterColumns(DistTyp))
workSheet.Cell($"{ColumnNameTable[ColumnNumber++ + 1]}5").Value = Col;
workSheet.Column("D").Width = 40;
return 7;
}
break;
default:
return 7;
}
}
示例12: CreateXLSXHeadLines
private int CreateXLSXHeadLines(IXLWorksheet workSheet, IXLCell StartTableCell,
StatistikRootClass.StatistikDataSelectionTypes writeOutType)
{
workSheet.Column("A").Width = 2;
int LineNumber = StartTableCell.WorksheetRow().RowNumber();
int StartColumnIndex = StartTableCell.WorksheetColumn().ColumnNumber();
// FullTable.Theme = XLTableTheme.TableStyleLight20;
CreateGroupHeader(workSheet, "AG's, OrtsTeile, Orte", LineNumber, StartColumnIndex, 6);
workSheet.Column(StartColumnIndex).Width = 3;
workSheet.Column(StartColumnIndex + 1).Width = 3;
workSheet.Column(StartColumnIndex + 2).Width = 3;
int OldStartColumnIndex = StartColumnIndex;
foreach (string LevelText in StandardCounter.AllHeadLines["LevelHeadLines"])
{
if ((LevelText == "Gesamt")
|| (LevelText == "AddProcesses")
|| (LevelText == "Beschreibung")
)
continue;
CreateVerticalNumberHeader(workSheet, LevelText, LineNumber + 1, StartColumnIndex++);
}
workSheet.Column(OldStartColumnIndex + 3).Width = 20;
workSheet.Column(StartColumnIndex).Width = 1;
workSheet.Cell(LineNumber, StartColumnIndex++).Style.Fill.SetBackgroundColor(XLColor.White);
CreateGroupHeader(workSheet, "WMU Punkte", LineNumber, StartColumnIndex, 3);
// StartColumnIndex = 8;
foreach (string LevelText in StandardCounter.AllHeadLines["WMUHeadLines"])
{
CreateVerticalNumberHeader(workSheet,
LevelText.Replace("W", "Weiblich").Replace("M", "Männlich").Replace("U", "Unbekannt"),
LineNumber + 1, StartColumnIndex++);
}
workSheet.Column(StartColumnIndex).Width = 1;
workSheet.Cell(LineNumber, StartColumnIndex++).Style.Fill.SetBackgroundColor(XLColor.White);
CreateGroupHeader(workSheet, "Projekt Phasen", LineNumber, StartColumnIndex, 5);
foreach (string LevelText in StandardCounter.AllHeadLines["ProjektPhasenHeadLines"])
{
CreateVerticalNumberHeader(workSheet, LevelText,
LineNumber + 1, StartColumnIndex++);
}
// StandardCounter.AllHeadLines
IXLCell StartCell = workSheet.Cell(LineNumber, StartColumnIndex);
int RunningColumn = StartCell.Address.ColumnNumber;
int RunningRow = StartCell.Address.RowNumber;
foreach (string writeOutSpecificHeadLine in StandardCounter.GetWriteOutSpecificHeadLines(writeOutType).Keys)
{
workSheet.Column(RunningColumn).Width = 1;
workSheet.Cell(RunningRow, RunningColumn++).Style.Fill.SetBackgroundColor(XLColor.White);
CreateGroupHeader(workSheet, writeOutSpecificHeadLine, LineNumber, RunningColumn,
StandardCounter.GetWriteOutSpecificHeadLines(writeOutType)[writeOutSpecificHeadLine].Count);
foreach (string ColumText in StandardCounter.GetWriteOutSpecificHeadLines(writeOutType)[writeOutSpecificHeadLine])
{
CreateVerticalNumberHeader(workSheet, ColumText, RunningRow + 1, RunningColumn++);
}
}
return 0;
}
示例13: ShowDataPerEntry
private IXLCell ShowDataPerEntry(IXLWorksheet workSheet,
StatistikRootClass.StatistikDataSelectionTypes writeOutType,
StandardCounter Counter, int StartRowIndex, int StartColumnIndex, bool showZeros = true)
{
int ActuallRow = StartRowIndex;
int ColumnIndex = StartColumnIndex;
foreach (string writeOutSpecificHeadLine in StandardCounter.GetWriteOutSpecificHeadLines(writeOutType).Keys)
{
workSheet.Column(ColumnIndex).Width = 1;
workSheet.Cell(ActuallRow, ColumnIndex++).Style.Fill.SetBackgroundColor(XLColor.White);
foreach (string columnText in StandardCounter.GetWriteOutSpecificHeadLines(writeOutType)[writeOutSpecificHeadLine])
{
ColumnIndex = SetOneValue(workSheet, ActuallRow, ColumnIndex,
Counter.GetWriteOutSpecificValues
(writeOutType)[writeOutSpecificHeadLine][columnText], showZeros);
}
}
return workSheet.Cell(ActuallRow, ColumnIndex);
}
示例14: AddHeader
private void AddHeader(VSProject project, IXLWorksheet worksheet, IEnumerable<CultureInfo> cultures)
{
worksheet.Cell(1, 1).Value = "ID";
worksheet.Cell(1, 2).Value = "Keys";
int c = 3;
foreach (var culture in cultures)
{
if (AutoAdjustLayout)
{
worksheet.Column(c).Width = ColumnValueWidth;
worksheet.Column(c).Style.Alignment.SetWrapText(true);
}
worksheet.Cell(1, c++).Value = culture.Name;
if (ExportComments)
{
if (AutoAdjustLayout)
{
worksheet.Column(c).Width = ColumnCommentWidth;
worksheet.Column(c).Style.Alignment.SetWrapText(true);
}
worksheet.Cell(1, c++).Value = culture.Name + " [Comments]";
}
}
}
示例15: SplitKD
private static bool SplitKD(IXLWorksheet worksheet, string title, int column)
{
// row to scan for KD
const int row = 6;
try
{
while (!worksheet.Cell(row, column).IsEmpty())
{
// scan for first KD derivative in TRIM LEVEL row
if (worksheet.Cell(row, column).GetString().EndsWith("KD"))
{
// remove existing column grouping - commented out as grouping no longer applied as you can't un-group on a protected worksheet
// worksheet.Columns(8, worksheet.LastColumnUsed().ColumnNumber()).Ungroup();
// add KD SPEC GROUP heading
worksheet.Cell(1, column).Value = title.ToUpper() + " KD";
// insert and size new divider column before KD derivatives
worksheet.Column(column).InsertColumnsBefore(1);
worksheet.Column(column).Width = 8;
// group non-KD derivatives - commented out as you can't un-group on a protected worksheet
// worksheet.Columns(8, column - 1).Group();
// merge non-KD SPEC GROUP heading
worksheet.Range(1, 8, 1, column - 1).Merge();
// group KD derivatives - commented out as you can't un-group on a protected worksheet
// worksheet.Columns(column + 1, worksheet.LastColumnUsed().ColumnNumber()).Group();
// merge KD SPEC GROUP heading
worksheet.Range(1, column + 1, 1, worksheet.LastColumnUsed().ColumnNumber()).Merge();
// add vertical KD title
worksheet.Cell(1, column).Value = title.ToUpper() + " KD";
// merge and format vertical divider heading
worksheet.Range(1, column, 9, column).Merge();
worksheet.Range(1, column, worksheet.LastRowUsed().RowNumber(), column).Style
.Font.SetBold(true)
.Font.SetFontColor(XLColor.White)
.Fill.SetBackgroundColor(XLColor.Black)
.Alignment.SetVertical(XLAlignmentVerticalValues.Bottom)
.Alignment.SetTextRotation(90);
// do for first KD derivative then break out
return true;
}
column = column + 1;
}
return false;
}
catch (Exception ex)
{
Log.Error(ex);
throw;
}
}