1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75:
| using System; using System.Collections.Generic; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Reflection; using System.Xml; using System.IO;
namespace Standardkataloge { class program {
private static createXML xml;
public program() { xml = new createXML(); }
public static bool E = false; public static bool G = false; public static bool H = false; public static bool C = false; public static bool S = false; public static bool T = false; public static bool R = false;
public static int code = 100;
public static string[] array = new string[30]; public static string[] englishArray = new string[30]; public static string[] number = new string[30]; public static string[] department = new string[5]; public static string[] name = new string[5]; public static string[] date = new string[3]; public static char[] datelongC1 = new char[3]; public static char[] datelongD1 = new char[3];
private static object excel; private static object sheet; public static void Name(bool isName) { object rangeA1 = sheet.GetType().InvokeMember("Range", BindingFlags.GetProperty | BindingFlags.OptionalParamBinding, null, sheet, new object[2] { "A1", Missing.Value }); object rangeB1 = sheet.GetType().InvokeMember("Range", BindingFlags.GetProperty | BindingFlags.OptionalParamBinding, null, sheet, new object[2] { "B1", Missing.Value });
name[0] = Convert.ToString(rangeA1.GetType().InvokeMember("Value", BindingFlags.GetProperty, null, rangeA1, new object[0])); name[1] = Convert.ToString(rangeB1.GetType().InvokeMember("Value", BindingFlags.GetProperty, null, rangeB1, new object[0]));
Marshal.ReleaseComObject(rangeA1); Marshal.ReleaseComObject(rangeB1); }
[STAThread] public static void Main(String[] args) { excel = Marshal.GetActiveObject("Excel.Application"); sheet = excel.GetType().InvokeMember("ActiveSheet", BindingFlags.GetProperty, null, excel, new object[0]);
excel.get_Range("rangeWorkbookName", Type.Missing).Value2 = ThisWorkbook.Name;
Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new hauptoberflaeche());
Marshal.ReleaseComObject(sheet); Marshal.ReleaseComObject(excel);
} } } |