Projekt neu angelegt.
This commit is contained in:
commit
feb8b505d4
32
.gitignore
vendored
Normal file
32
.gitignore
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
#Ignore thumbnails created by Windows
|
||||||
|
Thumbs.db
|
||||||
|
#Ignore files built by Visual Studio
|
||||||
|
*.obj
|
||||||
|
*.exe
|
||||||
|
*.pdb
|
||||||
|
*.user
|
||||||
|
*.aps
|
||||||
|
*.pch
|
||||||
|
*.vspscc
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ncb
|
||||||
|
*.suo
|
||||||
|
*.tlb
|
||||||
|
*.tlh
|
||||||
|
*.bak
|
||||||
|
*.cache
|
||||||
|
*.ilk
|
||||||
|
*.log
|
||||||
|
[Bb]in
|
||||||
|
[Dd]ebug*/
|
||||||
|
*.lib
|
||||||
|
*.sbr
|
||||||
|
obj/
|
||||||
|
[Rr]elease*/
|
||||||
|
_ReSharper*/
|
||||||
|
[Tt]est[Rr]esult*
|
||||||
|
.vs/
|
||||||
|
#Nuget packages folder
|
||||||
|
packages/
|
||||||
BIN
Daten/Test_ExcelReadColumnISO 8735.xlsx
Normal file
BIN
Daten/Test_ExcelReadColumnISO 8735.xlsx
Normal file
Binary file not shown.
BIN
Daten/Test_ExcelReadColumnISO 8735_Template.xlsx
Normal file
BIN
Daten/Test_ExcelReadColumnISO 8735_Template.xlsx
Normal file
Binary file not shown.
BIN
Daten/Test_ExcelReadColumn_Zylinderstifte_ISO8735.xlsx
Normal file
BIN
Daten/Test_ExcelReadColumn_Zylinderstifte_ISO8735.xlsx
Normal file
Binary file not shown.
25
Test_ExcelReadColumn.sln
Normal file
25
Test_ExcelReadColumn.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.28307.572
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_ExcelReadColumn", "Test_ExcelReadColumn\Test_ExcelReadColumn.csproj", "{4F64CC57-8239-4CDF-A266-4CE88F65B0E1}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{4F64CC57-8239-4CDF-A266-4CE88F65B0E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4F64CC57-8239-4CDF-A266-4CE88F65B0E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4F64CC57-8239-4CDF-A266-4CE88F65B0E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4F64CC57-8239-4CDF-A266-4CE88F65B0E1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {C1F3C3D4-D652-4EF5-8874-A60BB7391369}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
6
Test_ExcelReadColumn/App.config
Normal file
6
Test_ExcelReadColumn/App.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
195
Test_ExcelReadColumn/Form1.Designer.cs
generated
Normal file
195
Test_ExcelReadColumn/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
namespace Test_ExcelReadColumn
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Erforderliche Designervariable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Verwendete Ressourcen bereinigen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Vom Windows Form-Designer generierter Code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erforderliche Methode für die Designerunterstützung.
|
||||||
|
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.buttonReadSapColumn = new System.Windows.Forms.Button();
|
||||||
|
this.dataGridViewExcelSAP = new System.Windows.Forms.DataGridView();
|
||||||
|
this.Object = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.VStat = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.Status = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.openFileDialogExcelSAP = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.dataGridViewExcelReuse = new System.Windows.Forms.DataGridView();
|
||||||
|
this.Item = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.StatusOld = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.StatusNew = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.Save = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||||
|
this.buttonReadReuseColumns = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSaveChanges = new System.Windows.Forms.Button();
|
||||||
|
this.openFileDialogExcelReuse = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelSAP)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelReuse)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonReadSapColumn
|
||||||
|
//
|
||||||
|
this.buttonReadSapColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.buttonReadSapColumn.Location = new System.Drawing.Point(12, 415);
|
||||||
|
this.buttonReadSapColumn.Name = "buttonReadSapColumn";
|
||||||
|
this.buttonReadSapColumn.Size = new System.Drawing.Size(120, 23);
|
||||||
|
this.buttonReadSapColumn.TabIndex = 0;
|
||||||
|
this.buttonReadSapColumn.Text = "Read SAP Columns";
|
||||||
|
this.buttonReadSapColumn.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonReadSapColumn.Click += new System.EventHandler(this.buttonReadSapColumn_Click);
|
||||||
|
//
|
||||||
|
// dataGridViewExcelSAP
|
||||||
|
//
|
||||||
|
this.dataGridViewExcelSAP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.dataGridViewExcelSAP.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridViewExcelSAP.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.Object,
|
||||||
|
this.VStat,
|
||||||
|
this.Status});
|
||||||
|
this.dataGridViewExcelSAP.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.dataGridViewExcelSAP.Name = "dataGridViewExcelSAP";
|
||||||
|
this.dataGridViewExcelSAP.Size = new System.Drawing.Size(345, 397);
|
||||||
|
this.dataGridViewExcelSAP.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// Object
|
||||||
|
//
|
||||||
|
this.Object.HeaderText = "Objekt";
|
||||||
|
this.Object.Name = "Object";
|
||||||
|
this.Object.Width = 80;
|
||||||
|
//
|
||||||
|
// VStat
|
||||||
|
//
|
||||||
|
this.VStat.HeaderText = "VStat";
|
||||||
|
this.VStat.Name = "VStat";
|
||||||
|
this.VStat.Width = 120;
|
||||||
|
//
|
||||||
|
// Status
|
||||||
|
//
|
||||||
|
this.Status.HeaderText = "Status";
|
||||||
|
this.Status.Name = "Status";
|
||||||
|
this.Status.Width = 80;
|
||||||
|
//
|
||||||
|
// dataGridViewExcelReuse
|
||||||
|
//
|
||||||
|
this.dataGridViewExcelReuse.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.dataGridViewExcelReuse.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridViewExcelReuse.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.Item,
|
||||||
|
this.StatusOld,
|
||||||
|
this.StatusNew,
|
||||||
|
this.Save});
|
||||||
|
this.dataGridViewExcelReuse.Location = new System.Drawing.Point(363, 12);
|
||||||
|
this.dataGridViewExcelReuse.Name = "dataGridViewExcelReuse";
|
||||||
|
this.dataGridViewExcelReuse.Size = new System.Drawing.Size(425, 397);
|
||||||
|
this.dataGridViewExcelReuse.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// Item
|
||||||
|
//
|
||||||
|
this.Item.HeaderText = "Item";
|
||||||
|
this.Item.Name = "Item";
|
||||||
|
//
|
||||||
|
// StatusOld
|
||||||
|
//
|
||||||
|
this.StatusOld.HeaderText = "Status old";
|
||||||
|
this.StatusOld.Name = "StatusOld";
|
||||||
|
this.StatusOld.Width = 110;
|
||||||
|
//
|
||||||
|
// StatusNew
|
||||||
|
//
|
||||||
|
this.StatusNew.HeaderText = "Status New";
|
||||||
|
this.StatusNew.Name = "StatusNew";
|
||||||
|
this.StatusNew.Width = 110;
|
||||||
|
//
|
||||||
|
// Save
|
||||||
|
//
|
||||||
|
this.Save.HeaderText = "Save";
|
||||||
|
this.Save.Name = "Save";
|
||||||
|
this.Save.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.Save.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||||
|
this.Save.Width = 40;
|
||||||
|
//
|
||||||
|
// buttonReadReuseColumns
|
||||||
|
//
|
||||||
|
this.buttonReadReuseColumns.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.buttonReadReuseColumns.Enabled = false;
|
||||||
|
this.buttonReadReuseColumns.Location = new System.Drawing.Point(363, 415);
|
||||||
|
this.buttonReadReuseColumns.Name = "buttonReadReuseColumns";
|
||||||
|
this.buttonReadReuseColumns.Size = new System.Drawing.Size(120, 23);
|
||||||
|
this.buttonReadReuseColumns.TabIndex = 3;
|
||||||
|
this.buttonReadReuseColumns.Text = "Read Reuse Columns";
|
||||||
|
this.buttonReadReuseColumns.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonReadReuseColumns.Click += new System.EventHandler(this.buttonReadReuseColumns_Click);
|
||||||
|
//
|
||||||
|
// buttonSaveChanges
|
||||||
|
//
|
||||||
|
this.buttonSaveChanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.buttonSaveChanges.Enabled = false;
|
||||||
|
this.buttonSaveChanges.Location = new System.Drawing.Point(668, 415);
|
||||||
|
this.buttonSaveChanges.Name = "buttonSaveChanges";
|
||||||
|
this.buttonSaveChanges.Size = new System.Drawing.Size(120, 23);
|
||||||
|
this.buttonSaveChanges.TabIndex = 4;
|
||||||
|
this.buttonSaveChanges.Text = "Save Changes";
|
||||||
|
this.buttonSaveChanges.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSaveChanges.Click += new System.EventHandler(this.buttonSaveChanges_Click);
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.buttonSaveChanges);
|
||||||
|
this.Controls.Add(this.buttonReadReuseColumns);
|
||||||
|
this.Controls.Add(this.dataGridViewExcelReuse);
|
||||||
|
this.Controls.Add(this.dataGridViewExcelSAP);
|
||||||
|
this.Controls.Add(this.buttonReadSapColumn);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(808, 481);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.Text = "Form1";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelSAP)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewExcelReuse)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button buttonReadSapColumn;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridViewExcelSAP;
|
||||||
|
private System.Windows.Forms.OpenFileDialog openFileDialogExcelSAP;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridViewExcelReuse;
|
||||||
|
private System.Windows.Forms.Button buttonReadReuseColumns;
|
||||||
|
private System.Windows.Forms.Button buttonSaveChanges;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn Object;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn VStat;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn Status;
|
||||||
|
private System.Windows.Forms.OpenFileDialog openFileDialogExcelReuse;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn Item;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn StatusOld;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn StatusNew;
|
||||||
|
private System.Windows.Forms.DataGridViewCheckBoxColumn Save;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
349
Test_ExcelReadColumn/Form1.cs
Normal file
349
Test_ExcelReadColumn/Form1.cs
Normal file
@ -0,0 +1,349 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Microsoft.Office.Interop.Excel; // zusätzlich ist der Projektverweis auf COM -> Microsoft Excel xx-Objectlibrary
|
||||||
|
|
||||||
|
|
||||||
|
namespace Test_ExcelReadColumn
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
#region Version und Copyright
|
||||||
|
// Version und Copyright
|
||||||
|
string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
|
||||||
|
string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
|
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||||
|
string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||||
|
string icon = System.Windows.Forms.Application.StartupPath + "\\Info.bmp";
|
||||||
|
//Assembly Datum und Zeit
|
||||||
|
static DateTime value = AssemblyDateTime();
|
||||||
|
string date = value.ToShortDateString();
|
||||||
|
string time = value.ToLongTimeString();
|
||||||
|
private static DateTime AssemblyDateTime()
|
||||||
|
{
|
||||||
|
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision));
|
||||||
|
//Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
|
||||||
|
return buildDateTime;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Programm-Info
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the name of the program file
|
||||||
|
/// </summary>
|
||||||
|
public static string ProgramName { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the version of the program file
|
||||||
|
/// </summary>
|
||||||
|
public static string ProgramVersion { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the copyright notice
|
||||||
|
/// </summary>
|
||||||
|
public static string Copyright { set; get; }
|
||||||
|
|
||||||
|
private void SetProgramInfo()
|
||||||
|
{
|
||||||
|
//Name, Version und Copyright setzen
|
||||||
|
ProgramName = programName;
|
||||||
|
ProgramVersion = programVersion;
|
||||||
|
Copyright = copyright;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
const string colObject = "Objekt";
|
||||||
|
const string colVStatus = "VStat";
|
||||||
|
const string colItemNumber = "ItemNumber";
|
||||||
|
const string colStatus = "Status";
|
||||||
|
int colomnStatus = 0;
|
||||||
|
|
||||||
|
Range oRangeSap;
|
||||||
|
Range oRangeReuse;
|
||||||
|
|
||||||
|
//oExcelApp benötigt den kompletten Namensraum, da andernfalls der Compiler den Unterschied zwischen
|
||||||
|
//"Microsoft.Office.Interop.Excel.Application" und "System.Windows.Forms.Application" nicht erkennen kann
|
||||||
|
private Microsoft.Office.Interop.Excel.Application oExcelApp = new Microsoft.Office.Interop.Excel.Application();
|
||||||
|
private Workbook oWorkbook = null;
|
||||||
|
private Worksheet oWorksheet = null;
|
||||||
|
|
||||||
|
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
SetProgramInfo(); //Name, Version und Copyright setzen
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.MaximumSize = new Size(808, Screen.PrimaryScreen.Bounds.Height - 30); //Um 30 kleiner, weil sonst der untere Rand hinter der Start-Leiste verschwindet
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
//Beim Schließen des Fensters, Dokument schließen
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (oWorkbook != null)
|
||||||
|
{
|
||||||
|
oWorkbook.Close(); //Workbook schliessen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//Wurde das Workbook schon vorher geschlossen, dann landen wir hier.
|
||||||
|
//Nichts machen, nur den Fehler abfangen
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
oExcelApp.Quit(); //Excel schliessen
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonReadSapColumn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialogExcelSAP.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
buttonReadSapColumn.Enabled = false;
|
||||||
|
|
||||||
|
ReadSapColumnValues();
|
||||||
|
|
||||||
|
buttonReadReuseColumns.Enabled = true;
|
||||||
|
}
|
||||||
|
else //Bei Abbruch, Fenster schließen
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonReadReuseColumns_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialogExcelReuse.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
buttonReadReuseColumns.Enabled = false;
|
||||||
|
|
||||||
|
ReadReuseColumnValues();
|
||||||
|
|
||||||
|
buttonSaveChanges.Enabled = true;
|
||||||
|
}
|
||||||
|
else //Bei Abbruch, Fenster schließen
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
MatchValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSaveChanges_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//Save Columns
|
||||||
|
int range;
|
||||||
|
|
||||||
|
range = dataGridViewExcelReuse.Rows.Count;
|
||||||
|
|
||||||
|
for (int i = 1; i < range; i++)
|
||||||
|
{
|
||||||
|
if (dataGridViewExcelReuse.Rows[i].Cells[3].Value != null)
|
||||||
|
{
|
||||||
|
if ((bool)dataGridViewExcelReuse.Rows[i].Cells[3].Value == true)
|
||||||
|
{
|
||||||
|
(oWorksheet.Cells[i + 2, colomnStatus] as Range).Value = dataGridViewExcelReuse.Rows[i].Cells[2].Value.ToString();
|
||||||
|
(oWorksheet.Cells[i + 2, colomnStatus + 1] as Range).Value = "Yes";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oWorkbook.Save();
|
||||||
|
|
||||||
|
if (oWorkbook != null)
|
||||||
|
{
|
||||||
|
oWorkbook.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonSaveChanges.Enabled = false;
|
||||||
|
buttonReadSapColumn.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadSapColumnValues()
|
||||||
|
{
|
||||||
|
object oValue;
|
||||||
|
|
||||||
|
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
|
||||||
|
oWorkbook = oExcelApp.Workbooks.Open(openFileDialogExcelSAP.FileName);
|
||||||
|
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
|
||||||
|
oRangeSap = oWorksheet.UsedRange;
|
||||||
|
|
||||||
|
//Spaltennummern von Spalte 'Objekt' und 'VStat' ermitteln
|
||||||
|
int colomnObject = SapColumnNo(colObject);
|
||||||
|
int colomnVstatus = SapColumnNo(colVStatus);
|
||||||
|
|
||||||
|
for (int j = 2; j < oRangeSap.Rows.Count + 1; j++)
|
||||||
|
{
|
||||||
|
dataGridViewExcelSAP.Rows.Add();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 2; j < oRangeSap.Rows.Count + 1; j++)
|
||||||
|
{
|
||||||
|
oValue = (oRangeSap.Cells[j, colomnObject] as Range).Value;
|
||||||
|
if (oValue != null)
|
||||||
|
{
|
||||||
|
dataGridViewExcelSAP.Rows[j - 2].Cells[0].Value = oValue.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
oValue = (oRangeSap.Cells[j, colomnVstatus] as Range).Value;
|
||||||
|
if (oValue != null)
|
||||||
|
{
|
||||||
|
dataGridViewExcelSAP.Rows[j - 2].Cells[1].Value = oValue.ToString();
|
||||||
|
dataGridViewExcelSAP.Rows[j - 2].Cells[2].Value = oValue.ToString().Remove(oValue.ToString().LastIndexOf(")")).Remove(0, oValue.ToString().IndexOf("(") + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int SapColumnNo(string value)
|
||||||
|
{
|
||||||
|
Range oRange;
|
||||||
|
|
||||||
|
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
|
||||||
|
oWorkbook = oExcelApp.Workbooks.Open(openFileDialogExcelSAP.FileName);
|
||||||
|
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
|
||||||
|
oRange = oWorksheet.UsedRange;
|
||||||
|
|
||||||
|
int colomnNo = -1;
|
||||||
|
|
||||||
|
for (int i = 1; i < oRange.Columns.Count; i++)
|
||||||
|
{
|
||||||
|
if (oWorksheet.Cells[1, i].Value.ToString().ToLower() == value.ToLower())
|
||||||
|
{
|
||||||
|
colomnNo = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colomnNo; //-1 wenn Spalte nicht gefunden wurde
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadReuseColumnValues()
|
||||||
|
{
|
||||||
|
object oValue;
|
||||||
|
|
||||||
|
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
|
||||||
|
oWorkbook = oExcelApp.Workbooks.Open(openFileDialogExcelReuse.FileName);
|
||||||
|
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
|
||||||
|
oRangeReuse = oWorksheet.UsedRange;
|
||||||
|
|
||||||
|
//Spaltennummern von Spalte 'Objekt' und 'VStat' ermitteln
|
||||||
|
int colomnItem = ReuseColumnNo(colItemNumber);
|
||||||
|
colomnStatus = ReuseColumnNo(colStatus);
|
||||||
|
|
||||||
|
for (int j = 2; j < oRangeReuse.Rows.Count + 1; j++)
|
||||||
|
{
|
||||||
|
dataGridViewExcelReuse.Rows.Add();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 2; j < oRangeReuse.Rows.Count + 1; j++)
|
||||||
|
{
|
||||||
|
oValue = (oRangeReuse.Cells[j, colomnItem] as Range).Value;
|
||||||
|
if (oValue != null)
|
||||||
|
{
|
||||||
|
dataGridViewExcelReuse.Rows[j - 2].Cells[0].Value = oValue.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
oValue = (oRangeReuse.Cells[j, colomnStatus] as Range).Value;
|
||||||
|
if (oValue != null)
|
||||||
|
{
|
||||||
|
dataGridViewExcelReuse.Rows[j - 2].Cells[1].Value = oValue.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ReuseColumnNo(string value)
|
||||||
|
{
|
||||||
|
Range oRange;
|
||||||
|
|
||||||
|
// Datei öffnen und aktives Blatt und benutzten Bereich auswählen
|
||||||
|
oWorkbook = oExcelApp.Workbooks.Open(openFileDialogExcelReuse.FileName);
|
||||||
|
oWorksheet = (Worksheet)oWorkbook.ActiveSheet;
|
||||||
|
oRange = oWorksheet.UsedRange;
|
||||||
|
|
||||||
|
int colomnNo = -1;
|
||||||
|
|
||||||
|
for (int i = 1; i < oRange.Columns.Count; i++)
|
||||||
|
{
|
||||||
|
if (oWorksheet.Cells[1, i].Value != null)
|
||||||
|
{
|
||||||
|
if (oWorksheet.Cells[1, i].Value.ToString().ToLower() == value.ToLower())
|
||||||
|
{
|
||||||
|
colomnNo = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colomnNo; //-1 wenn Spalte nicht gefunden wurde
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MatchValues()
|
||||||
|
{
|
||||||
|
string value = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < oRangeReuse.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
//Zeilenweise die Spalte 1 einlesen. Wenn der Wert nicht '<Kein Wert>' ist, dann in der SAP Liste Spalte 1 durchsuchen ob der Wert existiert. Existiert der Wert, dann den Wert aus Spalte 3 in die Reuse Liste Spalte 3 schreiben und Spalte 4 setzen.
|
||||||
|
if (dataGridViewExcelReuse.Rows[i].Cells[0].Value != null)
|
||||||
|
{
|
||||||
|
if (dataGridViewExcelReuse.Rows[i].Cells[0].Value.ToString() != "<Kein Wert>")
|
||||||
|
{
|
||||||
|
value = DetermineValue(dataGridViewExcelReuse.Rows[i].Cells[0].Value.ToString());
|
||||||
|
|
||||||
|
if (dataGridViewExcelReuse.Rows[i].Cells[1].Value.ToString() != value)
|
||||||
|
{
|
||||||
|
if (value != "")
|
||||||
|
{
|
||||||
|
dataGridViewExcelReuse.Rows[i].Cells[2].Value = value;
|
||||||
|
dataGridViewExcelReuse.Rows[i].Cells[3].Value = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataGridViewExcelReuse.Rows[i].Cells[2].Value = dataGridViewExcelReuse.Rows[i].Cells[1].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataGridViewExcelReuse.Rows[i].Cells[2].Value = dataGridViewExcelReuse.Rows[i].Cells[1].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string DetermineValue(string value)
|
||||||
|
{
|
||||||
|
string newValue = "";
|
||||||
|
|
||||||
|
for (int j = 0; j < oRangeSap.Rows.Count; j++)
|
||||||
|
{
|
||||||
|
if (dataGridViewExcelSAP.Rows[j].Cells[0].Value != null)
|
||||||
|
{
|
||||||
|
if (dataGridViewExcelSAP.Rows[j].Cells[0].Value.ToString() == value)
|
||||||
|
{
|
||||||
|
newValue = dataGridViewExcelSAP.Rows[j].Cells[2].Value.ToString();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
168
Test_ExcelReadColumn/Form1.resx
Normal file
168
Test_ExcelReadColumn/Form1.resx
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="Object.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="VStat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Object.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="VStat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialogExcelSAP.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Item.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="StatusOld.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="StatusNew.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Save.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Item.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="StatusOld.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="StatusNew.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Save.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialogExcelReuse.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>199, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
22
Test_ExcelReadColumn/Program.cs
Normal file
22
Test_ExcelReadColumn/Program.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Test_ExcelReadColumn
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Test_ExcelReadColumn/Properties/AssemblyInfo.cs
Normal file
36
Test_ExcelReadColumn/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||||
|
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||||
|
// die einer Assembly zugeordnet sind.
|
||||||
|
[assembly: AssemblyTitle("Test_ExcelReadColumn")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Test_ExcelReadColumn")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019 by Eugen Höglinger")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
|
||||||
|
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
|
||||||
|
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||||
|
[assembly: Guid("4f64cc57-8239-4cdf-a266-4ce88f65b0e1")]
|
||||||
|
|
||||||
|
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||||
|
//
|
||||||
|
// Hauptversion
|
||||||
|
// Nebenversion
|
||||||
|
// Buildnummer
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||||
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
Test_ExcelReadColumn/Properties/Resources.Designer.cs
generated
Normal file
71
Test_ExcelReadColumn/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Dieser Code wurde von einem Tool generiert.
|
||||||
|
// Laufzeitversion: 4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
|
||||||
|
// der Code neu generiert wird.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Test_ExcelReadColumn.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||||
|
/// </summary>
|
||||||
|
// Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
|
||||||
|
// über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||||
|
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||||
|
// mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_ExcelReadColumn.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||||
|
/// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
Test_ExcelReadColumn/Properties/Resources.resx
Normal file
117
Test_ExcelReadColumn/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
Test_ExcelReadColumn/Properties/Settings.Designer.cs
generated
Normal file
30
Test_ExcelReadColumn/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Test_ExcelReadColumn.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Test_ExcelReadColumn/Properties/Settings.settings
Normal file
7
Test_ExcelReadColumn/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
112
Test_ExcelReadColumn/Test_ExcelReadColumn.csproj
Normal file
112
Test_ExcelReadColumn/Test_ExcelReadColumn.csproj
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{4F64CC57-8239-4CDF-A266-4CE88F65B0E1}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>Test_ExcelReadColumn</RootNamespace>
|
||||||
|
<AssemblyName>Test_ExcelReadColumn</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>false</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Form1.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form1.Designer.cs">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="Form1.resx">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<COMReference Include="Microsoft.Office.Core">
|
||||||
|
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
|
||||||
|
<VersionMajor>2</VersionMajor>
|
||||||
|
<VersionMinor>8</VersionMinor>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<WrapperTool>primary</WrapperTool>
|
||||||
|
<Isolated>False</Isolated>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
|
<COMReference Include="Microsoft.Office.Interop.Excel">
|
||||||
|
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
|
||||||
|
<VersionMajor>1</VersionMajor>
|
||||||
|
<VersionMinor>9</VersionMinor>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<WrapperTool>primary</WrapperTool>
|
||||||
|
<Isolated>False</Isolated>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
|
<COMReference Include="VBIDE">
|
||||||
|
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
|
||||||
|
<VersionMajor>5</VersionMajor>
|
||||||
|
<VersionMinor>3</VersionMinor>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<WrapperTool>primary</WrapperTool>
|
||||||
|
<Isolated>False</Isolated>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue
Block a user