From 9aba9bbb5682cae407dfb1e52c80f57494ed38d6 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期一, 13 七月 2020 14:12:57 +0800 Subject: [PATCH] 测试 excel导出 --- src/ExcelTest/Form1.resx | 120 +++++++++ src/Bro.M071.DBManager/packages.config | 2 src/Bro.M071.DBManager/Bro.M071.DBManager.csproj | 4 M071.sln | 14 + src/Bro.M071.DBManager/ExcelExportHelper.cs | 10 src/ExcelTest/Properties/Resources.resx | 117 +++++++++ src/ExcelTest/Program.cs | 22 + src/ExcelTest/Properties/AssemblyInfo.cs | 36 ++ src/ExcelTest/Properties/Resources.Designer.cs | 71 +++++ src/ExcelTest/Properties/Settings.settings | 7 src/Bro.M071.Process/M071Process.cs | 12 src/ExcelTest/Form1.Designer.cs | 61 ++++ src/ExcelTest/Properties/Settings.Designer.cs | 30 ++ src/ExcelTest/App.config | 18 + src/ExcelTest/Form1.cs | 121 +++++++++ src/ExcelTest/ExcelTest.csproj | 93 +++++++ 16 files changed, 728 insertions(+), 10 deletions(-) diff --git a/M071.sln b/M071.sln index 63c2069..44b1623 100644 --- a/M071.sln +++ b/M071.sln @@ -33,6 +33,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bro.M071.DBManager", "src\Bro.M071.DBManager\Bro.M071.DBManager.csproj", "{230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelTest", "src\ExcelTest\ExcelTest.csproj", "{A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -215,6 +217,18 @@ {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|Any CPU.Build.0 = Release|Any CPU {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|x64.ActiveCfg = Release|x64 {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|x64.Build.0 = Release|x64 + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug|x64.ActiveCfg = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug|x64.Build.0 = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug1|Any CPU.ActiveCfg = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug1|Any CPU.Build.0 = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug1|x64.ActiveCfg = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Debug1|x64.Build.0 = Debug|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Release|Any CPU.Build.0 = Release|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Release|x64.ActiveCfg = Release|Any CPU + {A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Bro.M071.DBManager/Bro.M071.DBManager.csproj b/src/Bro.M071.DBManager/Bro.M071.DBManager.csproj index 3ab26b5..cb09d48 100644 --- a/src/Bro.M071.DBManager/Bro.M071.DBManager.csproj +++ b/src/Bro.M071.DBManager/Bro.M071.DBManager.csproj @@ -80,8 +80,8 @@ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> </Reference> - <Reference Include="EPPlus, Version=5.2.0.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL"> - <HintPath>..\..\packages\EPPlus.5.2.0\lib\net45\EPPlus.dll</HintPath> + <Reference Include="EPPlus, Version=4.5.3.3, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EPPlus.4.5.3.3\lib\net40\EPPlus.dll</HintPath> </Reference> <Reference Include="PresentationCore" /> <Reference Include="SQLite.CodeFirst, Version=1.5.3.29, Culture=neutral, PublicKeyToken=eb96ba0a78d831a7, processorArchitecture=MSIL"> diff --git a/src/Bro.M071.DBManager/ExcelExportHelper.cs b/src/Bro.M071.DBManager/ExcelExportHelper.cs index 0ea0c16..17cadb7 100644 --- a/src/Bro.M071.DBManager/ExcelExportHelper.cs +++ b/src/Bro.M071.DBManager/ExcelExportHelper.cs @@ -19,6 +19,13 @@ public Dictionary<string, Dictionary<string, string>> WorksheetColumns { get; set; } public Dictionary<string, DataTable> WorksheetDataTable { get; set; } + public ExcelExportSet() + { + Worksheets = new List<string>(); + WorksheetColumns = new Dictionary<string, Dictionary<string, string>>(); + WorksheetDataTable = new Dictionary<string, DataTable>(); + } + } /// <summary> @@ -70,6 +77,7 @@ /// <returns></returns> public static byte[] ExportExcel(ExcelExportSet excelExportDto, bool showSrNo = false) { + //ExcelPackage.LicenseContext = LicenseContext.Commercial; 5.0浠ヤ笂鐗堟湰 闇�瑕佹巿鏉� byte[] result = null; using (ExcelPackage package = new ExcelPackage()) { @@ -132,8 +140,8 @@ workSheet.InsertRow(1, 1); workSheet.Column(1).Width = 5; } - result = package.GetAsByteArray(); } + result = package.GetAsByteArray(); } return result; } diff --git a/src/Bro.M071.DBManager/packages.config b/src/Bro.M071.DBManager/packages.config index 60bc1ae..ddd359f 100644 --- a/src/Bro.M071.DBManager/packages.config +++ b/src/Bro.M071.DBManager/packages.config @@ -1,7 +1,7 @@ 锘�<?xml version="1.0" encoding="utf-8"?> <packages> <package id="EntityFramework" version="6.4.0" targetFramework="net452" /> - <package id="EPPlus" version="5.2.0" targetFramework="net452" /> + <package id="EPPlus" version="4.5.3.3" targetFramework="net452" /> <package id="SQLite.CodeFirst" version="1.5.3.29" targetFramework="net452" /> <package id="System.Data.SQLite" version="1.0.112.0" targetFramework="net452" /> <package id="System.Data.SQLite.Core" version="1.0.112.0" targetFramework="net452" /> diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs index 21775d8..b0b9ecf 100644 --- a/src/Bro.M071.Process/M071Process.cs +++ b/src/Bro.M071.Process/M071Process.cs @@ -489,18 +489,18 @@ measurementUnitResultAndKeyUnitDataSet.ProductionMeasurementRecord = productionMeasurementRecords; - foreach (var MeasurementUnitResult in pData.Measurements)//鑾峰彇鍒板崟涓祴閲忛」缁撴灉 + foreach (var measurementUnit in pData.Measurements)//鑾峰彇鍒板崟涓祴閲忛」缁撴灉 { MeasurementUnitResult measurementUnitResult = new MeasurementUnitResult(); measurementUnitResult.ProductionMeasurementRecordsId = productionMeasurementRecords.ID; - measurementUnitResult.MeasurementName = MeasurementUnitResult.Name; - measurementUnitResult.MeasurementType = MeasurementUnitResult.MeasureType; - measurementUnitResult.MeasurementValue = MeasurementUnitResult.Spec.ActualValue.ToString(); - measurementUnitResult.MeasurementResult = MeasurementUnitResult.Spec.MeasureResult.Value ? "OK" : "NG"; + measurementUnitResult.MeasurementName = measurementUnit.Name; + measurementUnitResult.MeasurementType = measurementUnit.MeasureType; + measurementUnitResult.MeasurementValue = measurementUnit.Spec.ActualValue.ToString(); + measurementUnitResult.MeasurementResult = measurementUnit.Spec.MeasureResult.Value ? "OK" : "NG"; measurementUnitResults.Add(measurementUnitResult); - foreach (var keyUnit in MeasurementUnitResult.KeyUnitCollection)//鑾峰彇鍗曚釜閿殑娴嬮噺缁撴灉 + foreach (var keyUnit in measurementUnit.KeyUnitCollection)//鑾峰彇鍗曚釜閿殑娴嬮噺缁撴灉 { foreach (var keyValue in keyUnit.MeasureValueDict)//鑾峰彇鍗曚釜閿殑鍗曚釜娴嬮噺item 缁撴灉 { diff --git a/src/ExcelTest/App.config b/src/ExcelTest/App.config new file mode 100644 index 0000000..001ef45 --- /dev/null +++ b/src/ExcelTest/App.config @@ -0,0 +1,18 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> + </startup> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Data.SQLite.EF6" publicKeyToken="db937bc2d44ff139" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> \ No newline at end of file diff --git a/src/ExcelTest/ExcelTest.csproj b/src/ExcelTest/ExcelTest.csproj new file mode 100644 index 0000000..2ab571f --- /dev/null +++ b/src/ExcelTest/ExcelTest.csproj @@ -0,0 +1,93 @@ +锘�<?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>{A6600DBD-1DFC-4BE3-9ED9-51104E9232A0}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>ExcelTest</RootNamespace> + <AssemblyName>ExcelTest</AssemblyName> + <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</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> + <ProjectReference Include="..\Bro.M071.DBManager\Bro.M071.DBManager.csproj"> + <Project>{230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}</Project> + <Name>Bro.M071.DBManager</Name> + </ProjectReference> + <ProjectReference Include="..\Bro.M071.Model\Bro.M071.Model.csproj"> + <Project>{AD645C48-5811-4B1E-B81F-D35D5E6B577F}</Project> + <Name>Bro.M071.Model</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/src/ExcelTest/Form1.Designer.cs b/src/ExcelTest/Form1.Designer.cs new file mode 100644 index 0000000..7b30a8c --- /dev/null +++ b/src/ExcelTest/Form1.Designer.cs @@ -0,0 +1,61 @@ +锘縩amespace ExcelTest +{ + partial class Form1 + { + /// <summary> + /// 蹇呴渶鐨勮璁″櫒鍙橀噺銆� + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// 娓呯悊鎵�鏈夋鍦ㄤ娇鐢ㄧ殑璧勬簮銆� + /// </summary> + /// <param name="disposing">濡傛灉搴旈噴鏀炬墭绠¤祫婧愶紝涓� true锛涘惁鍒欎负 false銆�</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 绐椾綋璁捐鍣ㄧ敓鎴愮殑浠g爜 + + /// <summary> + /// 璁捐鍣ㄦ敮鎸佹墍闇�鐨勬柟娉� - 涓嶈淇敼 + /// 浣跨敤浠g爜缂栬緫鍣ㄤ慨鏀规鏂规硶鐨勫唴瀹广�� + /// </summary> + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(105, 98); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + } +} + diff --git a/src/ExcelTest/Form1.cs b/src/ExcelTest/Form1.cs new file mode 100644 index 0000000..2b45114 --- /dev/null +++ b/src/ExcelTest/Form1.cs @@ -0,0 +1,121 @@ +锘縰sing Bro.M071.DBManager; +using Bro.M071.Model.Model; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ExcelTest +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + SaveExcel(); + SaveTxt(); + } + + public async void SaveExcel() + { + //if (!Config.IsCSVOutputEnabled) + // return; + + await Task.Run(() => + { + var measurementUnitResultAndKeyUnitDataSet = new ProductionMeasurementUnitResultAndKeyUnitDataSet(); + measurementUnitResultAndKeyUnitDataSet.KeyUnitDataList = new List<KeyUnitData>(); + measurementUnitResultAndKeyUnitDataSet.MeasurementUnitResultList = new List<MeasurementUnitResult>(); + for (int i = 0; i < 10; i++) + { + KeyUnitData keyUnitData = new KeyUnitData(); + keyUnitData.Key = "A" + i; + keyUnitData.MeasurementItem = "Z" + i; + keyUnitData.ItemValue = (i / 10).ToString(); + measurementUnitResultAndKeyUnitDataSet.KeyUnitDataList.Add(keyUnitData); + + + MeasurementUnitResult measurementUnitResult = new MeasurementUnitResult(); + measurementUnitResult.ProductionMeasurementRecordsId = Guid.NewGuid().ToString(); + measurementUnitResult.MeasurementName = "娴嬭瘯" + i; + measurementUnitResult.MeasurementType = "Slant"; + measurementUnitResult.MeasurementValue = (i + 10).ToString(); + measurementUnitResult.MeasurementResult = "OK"; + + measurementUnitResultAndKeyUnitDataSet.MeasurementUnitResultList.Add(measurementUnitResult); + } + + + ExcelExportSet excelExportDto = new ExcelExportSet(); + excelExportDto.Worksheets = new List<string>() { "鍘熷鏁版嵁", "妫�娴嬬粨鏋�" }; + var keyUnitColumns = new Dictionary<string, string>() + { + {"Key", "閿�"}, + {"MeasurementItem", "妫�娴嬮」"}, + {"ItemValue", "妫�娴嬪��"} + }; + var measurementUnitResultColumns = new Dictionary<string, string>() + { + {"MeasurementName", "妫�娴嬪悕绉�"}, + {"MeasurementType", "妫�娴嬬被鍨�"}, + {"MeasurementValue", "妫�娴嬪��"}, + {"MeasurementResult", "妫�娴嬬粨鏋�"}, + }; + excelExportDto.WorksheetColumns[excelExportDto.Worksheets[0]] = keyUnitColumns; + excelExportDto.WorksheetColumns[excelExportDto.Worksheets[1]] = measurementUnitResultColumns; + + excelExportDto.WorksheetDataTable[excelExportDto.Worksheets[0]] = ExcelExportHelper.ListToDataTable(measurementUnitResultAndKeyUnitDataSet.KeyUnitDataList, keyUnitColumns); + excelExportDto.WorksheetDataTable[excelExportDto.Worksheets[1]] = ExcelExportHelper.ListToDataTable(measurementUnitResultAndKeyUnitDataSet.MeasurementUnitResultList, measurementUnitResultColumns); ; + + byte[] filecontent = ExcelExportHelper.ExportExcel(excelExportDto, false); + string dir = Path.Combine(@"D:\PROJECTS\M071", DateTime.Now.ToString("yyyyMMdd")); + if (!Directory.Exists(dir)) + { + Directory.CreateDirectory(dir); + } + + FileStream fs = new FileStream(Path.Combine(dir, $"test_133535.xlsx"), FileMode.Append, FileAccess.Write); + fs.Write(filecontent, 0, filecontent.Length); + fs.Flush(); + fs.Close(); + }); + } + public void SaveTxt() + { + FileStream fs = null; + string filePath = "D:\\file1.txt"; + //灏嗗緟鍐欑殑鍏ユ暟鎹粠瀛楃涓茶浆鎹负瀛楄妭鏁扮粍 + Encoding encoder = Encoding.UTF8; + byte[] bytes = encoder.GetBytes("Hello World! \n\r"); + try + { + //fs = File.OpenWrite(filePath); + ////璁惧畾涔﹀啓鐨勫紑濮嬩綅缃负鏂囦欢鐨勬湯灏� + //fs.Position = fs.Length; + + fs = File.Open(filePath, FileMode.Append, FileAccess.Write); + //灏嗗緟鍐欏叆鍐呭杩藉姞鍒版枃浠舵湯灏� + fs.Write(bytes, 0, bytes.Length); + + } + catch (Exception ex) + { + Console.WriteLine("鏂囦欢鎵撳紑澶辫触{0}", ex.ToString()); + } + finally + { + fs.Close(); + } + } + } +} diff --git a/src/ExcelTest/Form1.resx b/src/ExcelTest/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/ExcelTest/Form1.resx @@ -0,0 +1,120 @@ +锘�<?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> +</root> \ No newline at end of file diff --git a/src/ExcelTest/Program.cs b/src/ExcelTest/Program.cs new file mode 100644 index 0000000..5abd828 --- /dev/null +++ b/src/ExcelTest/Program.cs @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ExcelTest +{ + static class Program + { + /// <summary> + /// 搴旂敤绋嬪簭鐨勪富鍏ュ彛鐐广�� + /// </summary> + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/src/ExcelTest/Properties/AssemblyInfo.cs b/src/ExcelTest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..31934bf --- /dev/null +++ b/src/ExcelTest/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 鏈夊叧绋嬪簭闆嗙殑涓�鑸俊鎭敱浠ヤ笅 +// 鎺у埗銆傛洿鏀硅繖浜涚壒鎬у�煎彲淇敼 +// 涓庣▼搴忛泦鍏宠仈鐨勪俊鎭�� +[assembly: AssemblyTitle("ExcelTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ExcelTest")] +[assembly: AssemblyCopyright("Copyright 漏 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 灏� ComVisible 璁剧疆涓� false 浼氫娇姝ょ▼搴忛泦涓殑绫诲瀷 +//瀵� COM 缁勪欢涓嶅彲瑙併�傚鏋滈渶瑕佷粠 COM 璁块棶姝ょ▼搴忛泦涓殑绫诲瀷 +//璇峰皢姝ょ被鍨嬬殑 ComVisible 鐗规�ц缃负 true銆� +[assembly: ComVisible(false)] + +// 濡傛灉姝ら」鐩悜 COM 鍏紑锛屽垯涓嬪垪 GUID 鐢ㄤ簬绫诲瀷搴撶殑 ID +[assembly: Guid("a6600dbd-1dfc-4be3-9ed9-51104e9232a0")] + +// 绋嬪簭闆嗙殑鐗堟湰淇℃伅鐢变笅鍒楀洓涓�肩粍鎴�: +// +// 涓荤増鏈� +// 娆$増鏈� +// 鐢熸垚鍙� +// 淇鍙� +// +//鍙互鎸囧畾鎵�鏈夎繖浜涘�硷紝涔熷彲浠ヤ娇鐢ㄢ�滅敓鎴愬彿鈥濆拰鈥滀慨璁㈠彿鈥濈殑榛樿鍊� +//閫氳繃浣跨敤 "*"锛屽涓嬫墍绀�: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/ExcelTest/Properties/Resources.Designer.cs b/src/ExcelTest/Properties/Resources.Designer.cs new file mode 100644 index 0000000..082bf26 --- /dev/null +++ b/src/ExcelTest/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +锘�//------------------------------------------------------------------------------ +// <auto-generated> +// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆� +// 杩愯鏃剁増鏈�: 4.0.30319.42000 +// +// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳藉鑷翠笉姝g‘鐨勮涓猴紝濡傛灉 +// 閲嶆柊鐢熸垚浠g爜锛屽垯鎵�鍋氭洿鏀瑰皢涓㈠け銆� +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace ExcelTest.Properties +{ + + + /// <summary> + /// 寮虹被鍨嬭祫婧愮被锛岀敤浜庢煡鎵炬湰鍦板寲瀛楃涓茬瓑銆� + /// </summary> + // 姝ょ被鏄敱 StronglyTypedResourceBuilder + // 绫婚�氳繃绫讳技浜� ResGen 鎴� Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆� + // 鑻ヨ娣诲姞鎴栧垹闄ゆ垚鍛橈紝璇风紪杈� .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛� ResGen + // (浠� /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆� + [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> + /// 杩斿洖姝ょ被浣跨敤鐨勭紦瀛� ResourceManager 瀹炰緥銆� + /// </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("ExcelTest.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// 瑕嗙洊褰撳墠绾跨▼鐨� CurrentUICulture 灞炴�� + /// 浣跨敤姝ゅ己绫诲瀷鐨勮祫婧愮被鐨勮祫婧愭煡鎵俱�� + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/src/ExcelTest/Properties/Resources.resx b/src/ExcelTest/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/src/ExcelTest/Properties/Resources.resx @@ -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> \ No newline at end of file diff --git a/src/ExcelTest/Properties/Settings.Designer.cs b/src/ExcelTest/Properties/Settings.Designer.cs new file mode 100644 index 0000000..45375ce --- /dev/null +++ b/src/ExcelTest/Properties/Settings.Designer.cs @@ -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 ExcelTest.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; + } + } + } +} diff --git a/src/ExcelTest/Properties/Settings.settings b/src/ExcelTest/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/src/ExcelTest/Properties/Settings.settings @@ -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> -- Gitblit v1.8.0