Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
private enum MyEnumChar
{
A = 1, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
}
using Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application excelApp = new Excel.ApplicationClass();
const int xlWBatWorkSheet = -4167;
Excel.Workbook newWorkbook = excelApp.Workbooks.Add(xlWBatWorkSheet);
Excel.Worksheet excelSheet = (Excel.Worksheet)newWorkbook.Worksheets[1];
excelSheet.Name = "Name der Tabelle";
i = 1;
j = 1;
foreach (DataColumn col in this.dsExport.Tables[0].Columns)
{
excelSheet.Cells[i, j] = col.ColumnName.ToString();
excelSheet.get_Range(((MyEnumChar)j).ToString() + i, Type.Missing).Font.FontStyle = "Fett";
j++;
}
foreach (DataRow row in this.dsExport.Tables[0].Rows)
{
i++;
for (j = 1; j <= row.ItemArray.Count(); j++)
{
try
{
DateTime myDateTime = Convert.ToDateTime(row[j-1]);
excelSheet.Cells[i, j] = myDateTime.ToString("dd.MM.yyyy");
}
catch
{
excelSheet.Cells[i, j] = row[j - 1];
}
}
}
excelApp.Visible = true;