H
Haicho
Guest
Hello,
I´m new in Programing,
and i hope someone can help me.
this is my source code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
namespace GUI_6600
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e){
}
private void label1_Click(object sender, EventArgs e)
{
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Excel.Application xlsx = new Microsoft.Office.Interop.Excel.Application();
Workbook wb = xlsx.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws = (Worksheet)xlsx.ActiveSheet;
xlsx.Visible = true;
ws.Cells[1, 1] = "FAHNEN NUMMER :";
ws.Cells[1, 2] = "BEANSTANDUNG :";
ws.Cells[1, 3] = "NAME :";
ws.Cells[1, 4] = "DATUM :";
ws.Cells[1, 5] = "ZUSTÄNDIGKEITS-BERREICH :";
ws.Cells[2, 1] = Fahne.Text;
ws.Cells[2, 2] = BEANSTANDUNG.Text;
ws.Cells[2, 3] = NAME.Text;
ws.Cells[2, 4] = DATUM.Text;
ws.Cells[2, 5] = BERREICH.Text;
wb.SaveAs("5S_DIGITAL_6600.xlsx");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click_1(object sender, EventArgs e)
{
this.Close();
}
}
}
My Problem is that the Code gererates every Time a ney Excel Sheet and so it is not possible to add a few things in my Excel list.
Because every time the code overrides the same Cells.
Hopefully someone can help me that the code works normaly.
What i expect from the Code is that i fill in at the Different "Textboxes" some informations
and the Code should transfer it into Excel.
Hopefully someone could help me
Thank you very much
Continue reading...
I´m new in Programing,
and i hope someone can help me.
this is my source code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
namespace GUI_6600
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e){
}
private void label1_Click(object sender, EventArgs e)
{
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Excel.Application xlsx = new Microsoft.Office.Interop.Excel.Application();
Workbook wb = xlsx.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws = (Worksheet)xlsx.ActiveSheet;
xlsx.Visible = true;
ws.Cells[1, 1] = "FAHNEN NUMMER :";
ws.Cells[1, 2] = "BEANSTANDUNG :";
ws.Cells[1, 3] = "NAME :";
ws.Cells[1, 4] = "DATUM :";
ws.Cells[1, 5] = "ZUSTÄNDIGKEITS-BERREICH :";
ws.Cells[2, 1] = Fahne.Text;
ws.Cells[2, 2] = BEANSTANDUNG.Text;
ws.Cells[2, 3] = NAME.Text;
ws.Cells[2, 4] = DATUM.Text;
ws.Cells[2, 5] = BERREICH.Text;
wb.SaveAs("5S_DIGITAL_6600.xlsx");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click_1(object sender, EventArgs e)
{
this.Close();
}
}
}
My Problem is that the Code gererates every Time a ney Excel Sheet and so it is not possible to add a few things in my Excel list.
Because every time the code overrides the same Cells.
Hopefully someone can help me that the code works normaly.
What i expect from the Code is that i fill in at the Different "Textboxes" some informations
and the Code should transfer it into Excel.
Hopefully someone could help me
Thank you very much
Continue reading...