public ExcelCell(CellSet cs, int row, int col, int excelRow, int excelCol, ExcelWorksheet wb, Parser parser, ebexcel.ExcelCell hssfCell) { this.cellSet_0 = cs; this.int_0 = row; this.int_1 = col; this.int_2 = excelRow; this.int_3 = excelCol; this.excelWorksheet_0 = wb; this.parser_0 = parser; this.excelCell_0 = hssfCell; }
private int[] method_0(ExcelWorksheet excelWorksheet_0, CellSet cellSet_0, ArrayList arrayList_1, ArrayList arrayList_2, short short_0, short short_1, Hashtable hashtable_0) { Parser parser = new Parser(cellSet_0); int rowCount = parser.RowCount; int colCount = parser.ColCount; int num3 = 1; int num4 = rowCount - 1; Field pageHeader = parser.PageHeader; Field pageFooter = parser.PageFooter; if (pageHeader != null) { num3 = pageHeader.EndRow + 1; } if (pageFooter != null) { num4 = pageFooter.StartRow - 1; } short excelCol = short_1; for (int i = 1; i < colCount; i++) { short num11 = (short)parser.getColWidth(i); num11 = (short)((num11 * 46.44) * 0.8); if (!parser.isColVisible(i)) { num11 = 0; } excelCol++; excelWorksheet_0.Columns[excelCol].Width = num11; } short excelRow = short_0; for (int j = num3; j <= num4; j++) { ExcelRow row = excelWorksheet_0.Rows[excelRow]; short num9 = (short)parser.getRowHeight(j); num9 = (short)((num9 * 20.64) * 0.75); if (!parser.isRowVisible(j)) { num9 = 0; } row.Height = num9; excelCol = short_1; for (int k = 1; k < colCount; k++) { ebexcel.ExcelCell hssfCell = row.Cells[excelCol]; new ExcelCell(cellSet_0, j, k, excelRow, excelCol, excelWorksheet_0, parser, hssfCell).drawCell(); excelCol++; } excelRow++; } return(new int[] { (excelRow - 1), (excelCol - 1) }); }
public void InsertCopy(int columnCount, ExcelColumn sourceColumn) { ExcelRowCollection rows = sourceColumn.Parent.Parent.Rows; int num = 0; foreach (ExcelRow row in base.Parent.Parent.Rows) { ExcelCellCollection allocatedCells = rows[num].AllocatedCells; ExcelCell sourceCell = null; if (allocatedCells.Count > sourceColumn.Index) { sourceCell = allocatedCells[sourceColumn.Index]; } row.AllocatedCells.Insert(base.Index, columnCount, sourceCell); num++; } ((ExcelColumnCollection)base.Parent).InsertInternal(base.Index, columnCount, sourceColumn); }
public void CopyTo(ExcelWorksheet destinationWorksheet, int absoluteRow, int absoluteColumn) { CellRange range; try { range = destinationWorksheet.Cells.GetSubrangeAbsolute(absoluteRow, absoluteColumn, (absoluteRow + this.Height) - 1, (absoluteColumn + this.Width) - 1); } catch (Exception) { throw new ArgumentException("Destination range is incorrectly specified."); } if (this.Overlaps(range)) { throw new ArgumentException("Destination range can't overlap with source range."); } if (range.IsAnyCellMerged) { throw new ArgumentException("Destination range can't overlap with existing merged range."); } int num = absoluteRow - this.firstRow; int num2 = absoluteColumn - this.firstColumn; Hashtable hashtable = new Hashtable(); CellRangeEnumerator readEnumerator = this.GetReadEnumerator(); while (readEnumerator.MoveNext()) { ExcelCell currentCell = readEnumerator.CurrentCell; ExcelCell cell2 = destinationWorksheet.Rows[readEnumerator.CurrentRow + num].AllocatedCells[readEnumerator.CurrentColumn + num2]; cell2.Value = currentCell.Value; cell2.Style = currentCell.Style; CellRange mergedRange = currentCell.MergedRange; if (mergedRange != null) { hashtable[mergedRange] = (mergedRange); } } foreach (MergedCellRange range3 in hashtable.Values)//.get_Values()) { destinationWorksheet.Cells.GetSubrangeAbsolute(range3.firstRow + num, range3.firstColumn + num2, range3.lastRow + num, range3.lastColumn + num2).Merged = true; } }
internal void Insert(int index, int count, ExcelCell sourceCell) { if (sourceCell != null) { this.AdjustArraySize(index); } if (base.Count > index) { for (int i = 0; i < count; i++) { ExcelCell cell; if (sourceCell == null) { cell = new ExcelCell(base.Parent); } else { cell = new ExcelCell(base.Parent, sourceCell); } base.Items.Insert(index, cell); } } }
private static int smethod_0(ExcelWorksheet excelWorksheet_0) { int num = 1; foreach (ExcelRow row in excelWorksheet_0.Rows) { int num2 = 0; //using ( IEnumerator enumerator2 = row.AllocatedCells.GetEnumerator(); //) { while (enumerator2.MoveNext()) { ebexcel.ExcelCell cell1 = (ebexcel.ExcelCell)enumerator2.Current; num2++; } } if (num2 > num) { num = num2; } } return(num); }
internal ExcelCell(ExcelWorksheet parent, ExcelCell sourceCell) : base(parent) { this.cellValue = sourceCell.ValueInternal; this.Style = sourceCell.Style; }
private void SaveCsvInternal(StreamWriter sw, char separator) { char[] chArray = new char[] { separator, '"', '\n' }; ExcelWorksheet activeWorksheet = this.Worksheets.ActiveWorksheet; int num = -1; int num2 = -1; int maxRowCount = 0; for (int i = 0; i < 2; i++) { if (i == 0) { maxRowCount = activeWorksheet.Rows.Count; } else { maxRowCount = num + 1; } for (int j = 0; j < maxRowCount; j++) { int count; if (i == 0) { count = activeWorksheet.Rows[j].AllocatedCells.Count; } else { count = num2 + 1; if (j >= (this.HashFactorA - this.HashFactorB)) { continue; } } for (int k = 0; k < count; k++) { ExcelCell cell = activeWorksheet.Cells[j, k]; object obj2 = cell.Value; if ((obj2 != null) && !(obj2 is DBNull)) { CellRange mergedRange = cell.MergedRange; if ((mergedRange == null) || ((mergedRange.FirstRowIndex == j) && (mergedRange.FirstColumnIndex == k))) { if (i == 0) { if (k > num2) { num2 = k; } } else { string str = obj2.ToString(); if (str.IndexOfAny(chArray) != -1) { StringBuilder builder = new StringBuilder(str); builder.Replace("\"", "\"\""); str = '"' + builder.ToString() + '"'; } sw.Write(str); } } } if ((i == 1) && ((k + 1) < count)) { sw.Write(separator); } } if (i == 0) { if (j > num) { num = j; } } else { sw.WriteLine(); } } } if (maxRowCount > (this.HashFactorA - this.HashFactorB)) { this.OnLimitReached(this.FileName, IoOperation.CsvWriting, maxRowCount, 1, false); } else if (maxRowCount > (((this.HashFactorA - this.HashFactorB) * 4) / 5)) { this.OnLimitNear(this.FileName, IoOperation.CsvWriting, maxRowCount, 1, false); } }
private static string smethod_1(ebexcel.ExcelCell excelCell_0) { string str = ""; StringBuilder builder = new StringBuilder(); if (!excelCell_0.Style.IsDefault) { builder.Append(" style=\""); string name = ""; name = excelCell_0.Style.Font.Name; if ((name != "") && (name != "宋体")) { builder.Append("FONT-FAMILY: " + name + ";"); } int size = excelCell_0.Style.Font.Size; if ((size / 20) != 12) { builder.Append("FONT-SIZE: " + Convert.ToString(size / 20) + "px;"); } Color patternForegroundColor = excelCell_0.Style.Font.Color; if ((patternForegroundColor != Color.Black) && (ColorTranslator.ToHtml(patternForegroundColor) != "#000000")) { builder.Append("COLOR: " + ColorTranslator.ToHtml(patternForegroundColor) + ";"); } patternForegroundColor = excelCell_0.Style.FillPattern.PatternForegroundColor; if (((patternForegroundColor != Color.White) && (ColorTranslator.ToHtml(patternForegroundColor) != "#ffffff")) && (ColorTranslator.ToHtml(patternForegroundColor) != "#000000")) { builder.Append("BACKGROUND-COLOR: " + ColorTranslator.ToHtml(patternForegroundColor) + ";"); } if (excelCell_0.Style.Font.Weight > 400) { builder.Append("FONT-WEIGHT: bold;"); } if (excelCell_0.Style.Font.Italic) { builder.Append("FONT-STYLE: italic;"); } if (excelCell_0.Style.Font.UnderlineStyle != UnderlineStyle.None) { builder.Append("TEXT-DECORATION: underline;"); } if (excelCell_0.Style.HorizontalAlignment != HorizontalAlignmentStyle.Right) { if (excelCell_0.Style.HorizontalAlignment == HorizontalAlignmentStyle.Center) { builder.Append("TEXT-ALIGN: center;"); } } else { builder.Append("TEXT-ALIGN: right;"); } CellBorder border = excelCell_0.Style.Borders[IndividualBorder.Right]; if (border.LineStyle != LineStyle.None) { builder.Append("BORDER-RIGHT: "); builder.Append(ColorTranslator.ToHtml(border.LineColor)); builder.Append(smethod_2(border.LineStyle) + ";"); } border = excelCell_0.Style.Borders[IndividualBorder.Bottom]; if (border.LineStyle != LineStyle.None) { builder.Append("BORDER-BOTTOM: "); builder.Append(ColorTranslator.ToHtml(border.LineColor)); builder.Append(smethod_2(border.LineStyle) + ";"); } border = excelCell_0.Style.Borders[IndividualBorder.Left]; if (border.LineStyle != LineStyle.None) { builder.Append("BORDER-LEFT: "); builder.Append(ColorTranslator.ToHtml(border.LineColor)); builder.Append(smethod_2(border.LineStyle) + ";"); } border = excelCell_0.Style.Borders[IndividualBorder.Top]; if (border.LineStyle != LineStyle.None) { builder.Append("BORDER-TOP: "); builder.Append(ColorTranslator.ToHtml(border.LineColor)); builder.Append(smethod_2(border.LineStyle) + ";"); } builder.Append("\""); } str = builder.ToString(); if (str == " style=\"\"") { str = ""; } return(str); }