示例#1
0
 void SetCellFormat(Excel.Cell excelCell, DataGridViewCell gridCell)
 {
     try
     {
         excelCell.NumberFormat = CellFormat(gridCell);
     } catch
     {
     }
 }
示例#2
0
 void ExportHeaders(Excel.Worksheet worksheet)
 {
     for (int column = 0, worksheetColumn = 1; column < m_grid.ColumnCount; column++)
     {
         if (IsExportableColumn(column))
         {
             Excel.Cell currentHeader = worksheet[1, worksheetColumn++];
             currentHeader.Value     = m_grid.Columns[column].HeaderText;
             currentHeader.Font.Bold = true;
             currentHeader.AutoFitEntireColumn();
         }
     }
 }
示例#3
0
        private void ExportHeaders(Excel.Worksheet worksheet)
        {
            int i   = 0;
            int num = 1;

            while (i < this.m_grid.ColumnCount)
            {
                if (this.IsExportableColumn(i))
                {
                    Excel.Cell cell = worksheet[1, num++];
                    cell.Value     = this.m_grid.Columns[i].HeaderText;
                    cell.Font.Bold = true;
                    cell.AutoFitEntireColumn();
                }
                i++;
            }
        }
示例#4
0
        void ExportCells(Excel.Worksheet worksheet)
        {
            for (int column = 0, worksheetColumn = 1; column < m_grid.ColumnCount; column++)
            {
                if (IsExportableColumn(column))
                {
                    for (int row = 0; row < m_grid.RowCount; row++)
                    {
                        Excel.Cell currentCell = worksheet[row + 2, worksheetColumn];
                        currentCell.Value = CellValue(m_grid[column, row]);
                        SetCellFormat(currentCell, m_grid[column, row]);
                    }

                    worksheetColumn++;
                }
            }
        }
示例#5
0
        private void ExportCells(Excel.Worksheet worksheet)
        {
            int i   = 0;
            int num = 1;

            while (i < this.m_grid.ColumnCount)
            {
                if (this.IsExportableColumn(i))
                {
                    for (int j = 0; j < this.m_grid.RowCount; j++)
                    {
                        Excel.Cell cell = worksheet[j + 2, num];
                        cell.Value = this.CellValue(this.m_grid[i, j]);
                        this.SetCellFormat(cell, this.m_grid[i, j]);
                    }
                    num++;
                }
                i++;
            }
        }