This commit is contained in:
2025-05-12 19:05:18 +08:00
19 changed files with 906 additions and 98 deletions
+2 -2
View File
@@ -876,7 +876,7 @@
<COMReference Include="Microsoft.Office.Interop.Excel">
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>9</VersionMinor>
<VersionMinor>6</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
@@ -885,7 +885,7 @@
<COMReference Include="Microsoft.Office.Interop.Word">
<Guid>{00020905-0000-0000-C000-000000000046}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>7</VersionMinor>
<VersionMinor>4</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
@@ -1,5 +1,4 @@
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using System;
using System.Collections;
+72 -72
View File
@@ -341,90 +341,90 @@ namespace BLL
}
#endregion
public static string GetPathByDocToHTML(string strFile)
{
if (string.IsNullOrEmpty(strFile))
{
return "0";//没有文件
}
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application()
{
Visible = false,
AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable
};
//Microsoft.Office.Interop.Word.ApplicationClass word = new Microsoft.Office.Interop.Word.ApplicationClass();
// word.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
Type wordType = word.GetType();
Microsoft.Office.Interop.Word.Documents docs = word.Documents;
//public static string GetPathByDocToHTML(string strFile)
//{
// if (string.IsNullOrEmpty(strFile))
// {
// return "0";//没有文件
// }
// Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application()
// {
// Visible = false,
// AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable
// };
// //Microsoft.Office.Interop.Word.ApplicationClass word = new Microsoft.Office.Interop.Word.ApplicationClass();
// // word.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
// Type wordType = word.GetType();
// Microsoft.Office.Interop.Word.Documents docs = word.Documents;
// 打开文件
Type docsType = docs.GetType();
// // 打开文件
// Type docsType = docs.GetType();
object fileName = strFile;
// object fileName = strFile;
Microsoft.Office.Interop.Word.Document doc = (Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open",
System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[] { fileName, true, true });
// Microsoft.Office.Interop.Word.Document doc = (Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open",
// System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[] { fileName, true, true });
// 转换格式,另存为html
Type docType = doc.GetType();
//给文件重新起名
string filename = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() +
System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
// // 转换格式,另存为html
// Type docType = doc.GetType();
// //给文件重新起名
// string filename = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() +
// System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
string strFileFolder = "/html/";
DateTime dt = DateTime.Now;
//以yyyymmdd形式生成子文件夹名
string strFileSubFolder = dt.Year.ToString();
strFileSubFolder += (dt.Month < 10) ? ("0" + dt.Month.ToString()) : dt.Month.ToString();
strFileSubFolder += (dt.Day < 10) ? ("0" + dt.Day.ToString()) : dt.Day.ToString();
string strFilePath = strFileFolder + strFileSubFolder + "/";
// 判断指定目录下是否存在文件夹,如果不存在,则创建
if (!Directory.Exists(strFilePath))
{
// 创建up文件夹
Directory.CreateDirectory(strFilePath);
}
// string strFileFolder = "/html/";
// DateTime dt = DateTime.Now;
// //以yyyymmdd形式生成子文件夹名
// string strFileSubFolder = dt.Year.ToString();
// strFileSubFolder += (dt.Month < 10) ? ("0" + dt.Month.ToString()) : dt.Month.ToString();
// strFileSubFolder += (dt.Day < 10) ? ("0" + dt.Day.ToString()) : dt.Day.ToString();
// string strFilePath = strFileFolder + strFileSubFolder + "/";
// // 判断指定目录下是否存在文件夹,如果不存在,则创建
// if (!Directory.Exists(strFilePath))
// {
// // 创建up文件夹
// Directory.CreateDirectory(strFilePath);
// }
//被转换的html文档保存的位置
// HttpContext.Current.Server.MapPath("html" + strFileSubFolder + filename + ".html")
string ConfigPath = strFilePath + filename + ".html";
object saveFileName = ConfigPath;
// //被转换的html文档保存的位置
// // HttpContext.Current.Server.MapPath("html" + strFileSubFolder + filename + ".html")
// string ConfigPath = strFilePath + filename + ".html";
// object saveFileName = ConfigPath;
/*下面是Microsoft Word 9 Object Library的写法,如果是10,可能写成:
* docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
* null, doc, new object[]{saveFileName, Word.WdSaveFormat.wdFormatFilteredHTML});
* 其它格式:
* wdFormatHTML
* wdFormatDocument
* wdFormatDOSText
* wdFormatDOSTextLineBreaks
* wdFormatEncodedText
* wdFormatRTF
* wdFormatTemplate
* wdFormatText
* wdFormatTextLineBreaks
* wdFormatUnicodeText
*/
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
null, doc, new object[] { saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML });
// /*下面是Microsoft Word 9 Object Library的写法,如果是10,可能写成:
// * docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
// * null, doc, new object[]{saveFileName, Word.WdSaveFormat.wdFormatFilteredHTML});
// * 其它格式:
// * wdFormatHTML
// * wdFormatDocument
// * wdFormatDOSText
// * wdFormatDOSTextLineBreaks
// * wdFormatEncodedText
// * wdFormatRTF
// * wdFormatTemplate
// * wdFormatText
// * wdFormatTextLineBreaks
// * wdFormatUnicodeText
// */
// docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
// null, doc, new object[] { saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML });
//docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
// null, doc, new object[] { saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML });
// //docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
// // null, doc, new object[] { saveFileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML });
//关闭文档
docType.InvokeMember("Close", System.Reflection.BindingFlags.InvokeMethod,
null, doc, new object[] { null, null, null });
// //关闭文档
// docType.InvokeMember("Close", System.Reflection.BindingFlags.InvokeMethod,
// null, doc, new object[] { null, null, null });
// 退出 Word
wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);
//转到新生成的页面
//return ("/" + filename + ".html");
// // 退出 Word
// wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);
// //转到新生成的页面
// //return ("/" + filename + ".html");
//转化HTML页面统一编码格式
TransHTMLEncoding(ConfigPath);
// //转化HTML页面统一编码格式
// TransHTMLEncoding(ConfigPath);
return (strFilePath + filename + ".html");
}
// return (strFilePath + filename + ".html");
//}
public static void TransHTMLEncoding(string strFilePath)
{
try
@@ -80,6 +80,16 @@ namespace BLL
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId);
}
/// <summary>
/// 根据流水段获取管线信息
/// </summary>
/// <param name="flowingSection"></param>
/// <returns></returns>
public static Model.HJGL_Pipeline GetPipelineByFlowingSection(string flowingSection)
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.FlowingSection == flowingSection);
}
/// <summary>
/// 根据管线id获取管线状态
/// </summary>
@@ -1,5 +1,4 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
@@ -1,5 +1,4 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using System;
using System.Collections;