Ver Fonte

增加到处Excel功能,未完成。

dail há 3 anos atrás
pai
commit
0991c259ca

BIN
.vs/MOTINOVA_Motor_Factory_Set/v17/.suo


+ 31 - 1
ExportForm.cs

@@ -10,6 +10,10 @@ using System.Windows.Forms;
 using System.Xml.Serialization;
 using System.Text.RegularExpressions;
 using System.Net;
+using Microsoft.Office.Interop.Excel;
+using Microsoft.Office.Core;
+using Application = Microsoft.Office.Interop.Excel.Application;
+using System.Reflection;
 
 namespace MOTINOVA_Motor_Factory_Set
 {
@@ -507,7 +511,7 @@ namespace MOTINOVA_Motor_Factory_Set
                 return;
             }
 
-            //保存为文件
+            //保存为配置文件
             if (textBox_Model.Text == string.Empty) //判断型号是否填写
             {
                 MessageBox.Show("请输入电机型号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
@@ -580,6 +584,32 @@ namespace MOTINOVA_Motor_Factory_Set
                     file.WriteLine("{0},{1}", entry.Key, entry.Value);
             }
 
+            //保存为Excel文件
+            try
+            {
+                string excelFileName = FilePath + Datenow + textBox_Model.Text + "_" + textBox_Client.Text + "_" + textBox_FW_Version.Text + "_" + textBox_TE_FW_Version.Text + "_" + ((textBox_Remark.Text == string.Empty) ? "" : textBox_Remark.Text + "_") + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".xls";
+                System.IO.File.Copy("FOQC成机参数检验标准_Temple.xls", excelFileName, true);//复制模板文件
+                Application myExcel = new Application();
+                Workbooks wbs = myExcel.Workbooks;
+                _Workbook wb = wbs.Add(excelFileName);//打开并显示文件
+                object Nothing = System.Reflection.Missing.Value;
+                _Worksheet mySheet1 = wb.Sheets[1];
+                string sheetName = mySheet1.Name;
+                mySheet1.Activate();
+                mySheet1.Cells[1, 5] = "VS 7500";
+
+                wb.Save();
+                wb.Close();
+                wbs.Close();
+                myExcel.Quit();
+                System.Runtime.InteropServices.Marshal.ReleaseComObject(myExcel);
+            }
+            catch (Exception ex)
+            {
+                throw (ex);
+            }
+
+
             MessageBox.Show("参数已生成,进入文件管理页面查看!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
             //发送文件到服务器

+ 39 - 0
MOTINOVA_Motor_Factory_Set.csproj

@@ -73,6 +73,7 @@
     <ApplicationIcon>import.ico</ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="Microsoft.CSharp" />
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Deployment" />
@@ -201,5 +202,43 @@
   <ItemGroup>
     <Content Include="import.ico" />
   </ItemGroup>
+  <ItemGroup>
+    <COMReference Include="Microsoft.Office.Core">
+      <Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
+      <VersionMajor>2</VersionMajor>
+      <VersionMinor>4</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>6</VersionMinor>
+      <Lcid>0</Lcid>
+      <WrapperTool>primary</WrapperTool>
+      <Isolated>False</Isolated>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </COMReference>
+    <COMReference Include="Office">
+      <Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
+      <VersionMajor>2</VersionMajor>
+      <VersionMinor>6</VersionMinor>
+      <Lcid>0</Lcid>
+      <WrapperTool>tlbimp</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>

BIN
bin/Debug/FOQC成机参数检验标准_Temple.xls


+ 1 - 1
bin/Debug/MOTINOVA_Motor_Factory_Set.application

@@ -14,7 +14,7 @@
           <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
         </dsig:Transforms>
         <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
-        <dsig:DigestValue>sXMFFIz75VfWw65tnuOio6wTFWo+x37VirSaVx4ZTiw=</dsig:DigestValue>
+        <dsig:DigestValue>7AhwowHBIvgQEZAcPB92fvZGhTaMEklaFEqeVx+XM2E=</dsig:DigestValue>
       </hash>
     </dependentAssembly>
   </dependency>

BIN
bin/Debug/MOTINOVA_Motor_Factory_Set.exe


+ 2 - 2
bin/Debug/MOTINOVA_Motor_Factory_Set.exe.manifest

@@ -42,14 +42,14 @@
     </dependentAssembly>
   </dependency>
   <dependency>
-    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MOTINOVA_Motor_Factory_Set.exe" size="686592">
+    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MOTINOVA_Motor_Factory_Set.exe" size="690688">
       <assemblyIdentity name="MOTINOVA_Motor_Factory_Set" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
       <hash>
         <dsig:Transforms>
           <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
         </dsig:Transforms>
         <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
-        <dsig:DigestValue>ftdhNJJbDoZTMk0rxfQwIk/f4/FrQcwFhbivVfIZIhw=</dsig:DigestValue>
+        <dsig:DigestValue>Fi60d2hz/Zr4Gd1BP9rff7pZ4rpdXaDaGA6RehtZw8g=</dsig:DigestValue>
       </hash>
     </dependentAssembly>
   </dependency>

BIN
bin/Debug/MOTINOVA_Motor_Factory_Set.pdb


+ 0 - 4
bin/Debug/SerialNum

@@ -1,4 +0,0 @@
-流水号:
-0
-合格计数:
-0

BIN
bin/Debug/app.publish/MOTINOVA_Motor_Factory_Set.exe


BIN
obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 1 - 1
obj/Debug/MOTINOVA_Motor_Factory_Set.application

@@ -14,7 +14,7 @@
           <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
         </dsig:Transforms>
         <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
-        <dsig:DigestValue>sXMFFIz75VfWw65tnuOio6wTFWo+x37VirSaVx4ZTiw=</dsig:DigestValue>
+        <dsig:DigestValue>7AhwowHBIvgQEZAcPB92fvZGhTaMEklaFEqeVx+XM2E=</dsig:DigestValue>
       </hash>
     </dependentAssembly>
   </dependency>

BIN
obj/Debug/MOTINOVA_Motor_Factory_Set.csproj.AssemblyReference.cache


+ 1 - 1
obj/Debug/MOTINOVA_Motor_Factory_Set.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-1266a5ed253e3a045cc8ecb5f1f9b282ae828f47
+7663e8147f63091413a1673bd002f8881f85cde1

+ 2 - 0
obj/Debug/MOTINOVA_Motor_Factory_Set.csproj.FileListAbsolute.txt

@@ -41,3 +41,5 @@ D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\MOTINOVA_
 D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\MOTINOVA_Motor_Factory_Set\MOTINOVA_Motor_Factory_Set\obj\Debug\MOTINOVA_Motor_Factory_Set.application
 D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\MOTINOVA_Motor_Factory_Set\MOTINOVA_Motor_Factory_Set\obj\Debug\MOTINOVA_Motor_Factory_Set.exe
 D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\MOTINOVA_Motor_Factory_Set\MOTINOVA_Motor_Factory_Set\obj\Debug\MOTINOVA_Motor_Factory_Set.pdb
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\MOTINOVA_Motor_Factory_Set\MOTINOVA_Motor_Factory_Set\obj\Debug\Interop.Office.dll
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\MOTINOVA_Motor_Factory_Set\MOTINOVA_Motor_Factory_Set\obj\Debug\MOTINOVA_Motor_Factory_Set.csproj.ResolveComReference.cache

BIN
obj/Debug/MOTINOVA_Motor_Factory_Set.exe


+ 2 - 2
obj/Debug/MOTINOVA_Motor_Factory_Set.exe.manifest

@@ -42,14 +42,14 @@
     </dependentAssembly>
   </dependency>
   <dependency>
-    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MOTINOVA_Motor_Factory_Set.exe" size="686592">
+    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MOTINOVA_Motor_Factory_Set.exe" size="690688">
       <assemblyIdentity name="MOTINOVA_Motor_Factory_Set" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
       <hash>
         <dsig:Transforms>
           <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
         </dsig:Transforms>
         <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
-        <dsig:DigestValue>ftdhNJJbDoZTMk0rxfQwIk/f4/FrQcwFhbivVfIZIhw=</dsig:DigestValue>
+        <dsig:DigestValue>Fi60d2hz/Zr4Gd1BP9rff7pZ4rpdXaDaGA6RehtZw8g=</dsig:DigestValue>
       </hash>
     </dependentAssembly>
   </dependency>

BIN
obj/Debug/MOTINOVA_Motor_Factory_Set.pdb