From 6ca2f993973295e4da82634761da0e5c00e0ef8e Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期二, 14 七月 2020 08:54:27 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- 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 | 175 +++++++++- 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 | 30 + src/ExcelTest/Form1.Designer.cs | 61 +++ src/ExcelTest/Properties/Settings.Designer.cs | 30 + src/Bro.M071.Model/Model/KeyUnitData.cs | 4 src/ExcelTest/App.config | 18 + src/ExcelTest/Form1.cs | 122 +++++++ src/Bro.M071.Model/Model/MeasurementUnitResult.cs | 4 src/ExcelTest/ExcelTest.csproj | 93 +++++ 18 files changed, 883 insertions(+), 47 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..ce6958e 100644 --- a/src/Bro.M071.DBManager/ExcelExportHelper.cs +++ b/src/Bro.M071.DBManager/ExcelExportHelper.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.IO; using System.Linq; namespace Bro.M071.DBManager @@ -18,6 +19,13 @@ /// </summary> 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>(); + } } @@ -70,6 +78,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()) { @@ -77,8 +86,9 @@ { var dataTable = excelExportDto.WorksheetDataTable[worksheet]; ExcelWorksheet workSheet = package.Workbook.Worksheets.Add($"{worksheet}"); - int startRowFrom = string.IsNullOrEmpty(worksheet) ? 1 : 3; //寮�濮嬬殑琛� - //鏄惁鏄剧ず琛岀紪鍙� + //int startRowFrom = string.IsNullOrEmpty(worksheet) ? 1 : 3; //寮�濮嬬殑琛� + int startRowFrom = 1; //寮�濮嬬殑琛� + //鏄惁鏄剧ず琛岀紪鍙� if (showSrNo) { DataColumn dataColumn = dataTable.Columns.Add("#", typeof(int)); @@ -92,19 +102,28 @@ } //Add Content Into the Excel File workSheet.Cells["A" + startRowFrom].LoadFromDataTable(dataTable, true); - // autofit width of cells with small content - int columnIndex = 1; - foreach (DataColumn item in dataTable.Columns) + + for (int columnIndex = 1; columnIndex <= dataTable.Columns.Count; columnIndex++) { + // autofit width of cells with small content ExcelRange columnCells = workSheet.Cells[workSheet.Dimension.Start.Row, columnIndex, workSheet.Dimension.End.Row, columnIndex]; int maxLength = columnCells.Max(cell => cell.Value.ToString().Count()); if (maxLength < 150) { workSheet.Column(columnIndex).AutoFit(); } - columnIndex++; + // 璁剧疆NG鍗曞厓鏍兼牱寮� + for (int rowIndex = 1; rowIndex <= dataTable.Rows.Count; rowIndex++) + { + if (columnCells[rowIndex, columnIndex].Text == "NG") + { + workSheet.Cells[rowIndex, columnIndex].Style.Font.Bold = true;//瀛椾綋涓虹矖浣� + workSheet.Cells[rowIndex, columnIndex].Style.Fill.PatternType = ExcelFillStyle.Solid; + workSheet.Cells[rowIndex, columnIndex].Style.Fill.BackgroundColor.SetColor(System.Drawing.ColorTranslator.FromHtml("#E33E33"));// 璁剧疆濉厖鏍峰紡 + } + } } - // format header - bold, yellow on black + // format header - bold, yellow on black 璁剧疆琛ㄥご鏍峰紡 using (ExcelRange r = workSheet.Cells[startRowFrom, 1, startRowFrom, dataTable.Columns.Count]) { r.Style.Font.Color.SetColor(System.Drawing.Color.White); @@ -124,34 +143,128 @@ r.Style.Border.Left.Color.SetColor(System.Drawing.Color.Black); r.Style.Border.Right.Color.SetColor(System.Drawing.Color.Black); } - if (!string.IsNullOrEmpty(worksheet)) - { - workSheet.Cells["A1"].Value = worksheet; - workSheet.Cells["A1"].Style.Font.Size = 20; - workSheet.InsertColumn(1, 1); - workSheet.InsertRow(1, 1); - workSheet.Column(1).Width = 5; - } - result = package.GetAsByteArray(); + //灏唖heet鍐欏叆琛ㄤ腑 + //if (!string.IsNullOrEmpty(worksheet)) + //{ + // workSheet.Cells["A1"].Value = worksheet; + // workSheet.Cells["A1"].Style.Font.Size = 20; + // workSheet.InsertColumn(1, 1); + // workSheet.InsertRow(1, 1); + // workSheet.Column(1).Width = 5; + //} } + result = package.GetAsByteArray(); } return result; } - ///// <summary> - ///// 瀵煎嚭Excel - ///// </summary> - ///// <typeparam name="T"></typeparam> - ///// <param name="data"></param> - ///// <param name="heading"></param> - ///// <param name="isShowSlNo"></param> - ///// <param name="columnsToTake"></param> - ///// <returns></returns> - //public static byte[] ExportExcel<T>(List<T> data, string heading = "", bool isShowSlNo = false, params string[] columnsToTake) - //{ - // ExcelExportSet excelExport = new ExcelExportSet(); - // excelExport. - // return ExportExcel(ListToDataTable(data), heading, isShowSlNo, columnsToTake); - //} + /// <summary> + /// 鏂板缓 鎴� 杩藉姞 鍐欏叆Excel + /// </summary> + /// <param name="excelExportDto"></param> + /// <param name="fileName">瑕佸啓鍏ョ殑鏂囦欢鍚�(鍏ㄨ矾寰勫悕)</param> + /// <param name="showSrNo"></param> + /// <returns></returns> + public static byte[] CreateOrAppendExcel(ExcelExportSet excelExportDto, string fileName, bool showSrNo = false) + { + byte[] result = null; + bool isExist = File.Exists(fileName); + ExcelExportSet newExcelSet = new ExcelExportSet(); + + if (isExist) + { + var oldWorksheetDataTable = WorksheetToTable(fileName, excelExportDto.Worksheets); + newExcelSet.Worksheets = excelExportDto.Worksheets; + newExcelSet.WorksheetColumns = excelExportDto.WorksheetColumns; + + foreach (var sheet in excelExportDto.Worksheets) + { + var oldTable = oldWorksheetDataTable[sheet]; + newExcelSet.WorksheetDataTable[sheet] = oldTable; + if (excelExportDto.WorksheetDataTable[sheet].Rows.Count > 0) + { + //鍚堝苟涓や釜 datatable + newExcelSet.WorksheetDataTable[sheet].Merge(excelExportDto.WorksheetDataTable[sheet]); + } + } + } + else + { + newExcelSet = excelExportDto; + } + + result = ExportExcel(newExcelSet, showSrNo); + return result; + } + + /// <summary> + ///灏嗘寚瀹氱殑Excel鐨勬枃浠惰浆鎹㈡垚DataTable 锛圗xcel鐨勬寚瀹歴heet锛� + /// </summary> + /// <param name="fullFielPath">鏂囦欢鐨勭粷瀵硅矾寰�</param> + /// <returns></returns> + public static Dictionary<string, DataTable> WorksheetToTable(string fullFielPath, List<string> worksheets) + { + try + { + var resultWorksheetDataTable = new Dictionary<string, DataTable>(); + FileInfo existingFile = new FileInfo(fullFielPath); + ExcelPackage package = new ExcelPackage(existingFile); + foreach (var sheet in worksheets) + { + ExcelWorksheet worksheet = package.Workbook.Worksheets[sheet];//閫夊畾 鎸囧畾椤� + var dataTable = WorksheetToTable(worksheet); + resultWorksheetDataTable[sheet] = dataTable; + } + return resultWorksheetDataTable; + } + catch (Exception) + { + throw; + } + } + + /// <summary> + /// 灏唚orksheet杞垚datatable + /// </summary> + /// <param name="worksheet">寰呭鐞嗙殑worksheet</param> + /// <returns>杩斿洖澶勭悊鍚庣殑datatable</returns> + public static DataTable WorksheetToTable(ExcelWorksheet worksheet) + { + //鑾峰彇worksheet鐨勮鏁� + int rows = worksheet.Dimension.End.Row; + //鑾峰彇worksheet鐨勫垪鏁� + int cols = worksheet.Dimension.End.Column; + + DataTable dt = new DataTable(worksheet.Name); + DataRow dr = null; + for (int i = 1; i <= rows; i++) + { + if (i > 1) + dr = dt.Rows.Add(); + + for (int j = 1; j <= cols; j++) + { + //榛樿灏嗙涓�琛岃缃负datatable鐨勬爣棰� + if (i == 1) + dt.Columns.Add(GetString(worksheet.Cells[i, j].Value)); + //鍓╀笅鐨勫啓鍏atatable + else + dr[j - 1] = GetString(worksheet.Cells[i, j].Value); + } + } + return dt; + } + private static string GetString(object obj) + { + try + { + return obj.ToString(); + } + catch (Exception) + { + return ""; + } + } + } } 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.Model/Model/KeyUnitData.cs b/src/Bro.M071.Model/Model/KeyUnitData.cs index ccea504..b583e78 100644 --- a/src/Bro.M071.Model/Model/KeyUnitData.cs +++ b/src/Bro.M071.Model/Model/KeyUnitData.cs @@ -1,6 +1,7 @@ 锘� using System; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace Bro.M071.Model.Model { @@ -32,6 +33,9 @@ /// </summary> [StringLength(64)] public string ItemValue { get; set; } + + [NotMapped] + public string ProductionBarcode { get; set; } } public class KeyUnitDataRequest : BaseRequest diff --git a/src/Bro.M071.Model/Model/MeasurementUnitResult.cs b/src/Bro.M071.Model/Model/MeasurementUnitResult.cs index 62898f4..278343f 100644 --- a/src/Bro.M071.Model/Model/MeasurementUnitResult.cs +++ b/src/Bro.M071.Model/Model/MeasurementUnitResult.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace Bro.M071.Model.Model { @@ -39,6 +40,9 @@ /// </summary> [StringLength(64)] public string MeasurementResult { get; set; } + + [NotMapped] + public string ProductionBarcode { get; set; } } public class MeasurementUnitResultRequest : BaseRequest diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs index 21775d8..70d01cd 100644 --- a/src/Bro.M071.Process/M071Process.cs +++ b/src/Bro.M071.Process/M071Process.cs @@ -414,8 +414,8 @@ { } - ////Excel鎶ヨ〃杈撳嚭 锛堝崟涓骇鍝佺殑excel瀵煎嚭锛� - //ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet); + //Excel鎶ヨ〃杈撳嚭 锛堝崟涓骇鍝佺殑excel瀵煎嚭锛� + ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet); ////鏁版嵁搴撲繚瀛� //SaveProductionData(measurementUnitResultAndKeyUnitDataSet); @@ -489,18 +489,19 @@ 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.ProductionBarcode = productionMeasurementRecords.ProductionBarcode; + 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 缁撴灉 { @@ -508,6 +509,7 @@ if (!isExist)//宸插瓨鍦� 涓嶉噸澶嶆坊鍔犲師濮嬫暟鎹� { KeyUnitData keyUnitData = new KeyUnitData(); + keyUnitData.ProductionBarcode = productionMeasurementRecords.ProductionBarcode; keyUnitData.Key = keyUnit.Key; keyUnitData.MeasurementItem = keyValue.Key; keyUnitData.ItemValue = keyValue.Value.ToString(); @@ -544,12 +546,14 @@ excelExportDto.Worksheets = new List<string>() { "鍘熷鏁版嵁", "妫�娴嬬粨鏋�" }; var keyUnitColumns = new Dictionary<string, string>() { + {"ProductionBarcode", "浜у搧鏉$爜"}, {"Key", "閿�"}, {"MeasurementItem", "妫�娴嬮」"}, {"ItemValue", "妫�娴嬪��"} }; var measurementUnitResultColumns = new Dictionary<string, string>() { + {"ProductionBarcode", "浜у搧鏉$爜"}, {"MeasurementName", "妫�娴嬪悕绉�"}, {"MeasurementType", "妫�娴嬬被鍨�"}, {"MeasurementValue", "妫�娴嬪��"}, @@ -561,14 +565,14 @@ 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(Config.LogPath, DateTime.Now.ToString("yyyyMMdd")); - if (!Directory.Exists(dir)) + if (!Directory.Exists(Config.LogPath)) { - Directory.CreateDirectory(dir); + Directory.CreateDirectory(Config.LogPath); } + var fileName = Path.Combine(Config.LogPath, $"ProductionData_{DateTime.Now.ToString("yyyyMMdd")}.xlsx"); - FileStream fs = new FileStream(Path.Combine(dir, $"{measurementUnitResultAndKeyUnitDataSet.ProductionMeasurementRecord.ProductionBarcode}_{DateTime.Now.ToString("HHmmss")}.xlsx"), FileMode.Create, FileAccess.Write); + byte[] filecontent = ExcelExportHelper.CreateOrAppendExcel(excelExportDto, fileName); + FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write); fs.Write(filecontent, 0, filecontent.Length); fs.Flush(); fs.Close(); 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..ddb97c6 --- /dev/null +++ b/src/ExcelTest/Form1.cs @@ -0,0 +1,122 @@ +锘縰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 = (i % 2) == 1? "OK":"NG"; + + 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); ; + + + string dir = Path.Combine(@"D:\PROJECTS\M071", DateTime.Now.ToString("yyyyMMdd")); + if (!Directory.Exists(dir)) + { + Directory.CreateDirectory(dir); + } + var fileName = Path.Combine(dir, $"test_133536.xlsx"); + byte[] filecontent = ExcelExportHelper.CreateOrAppendExcel(excelExportDto, fileName); + FileStream fs = new FileStream(fileName, FileMode.Create, 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