Browse Source

处理word文件上方警示文字

新疆体育高职分支
zhangli 1 year ago
parent
commit
aa5fd4670e
8 changed files with 155 additions and 5 deletions
  1. +8
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs
  2. +3
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Global.asax.cs
  3. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  4. +60
    -0
      Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/AsposeCore.cs
  5. +36
    -0
      Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/Properties/AssemblyInfo.cs
  6. +0
    -1
      Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/Quanjiang.DigitalSchool.Aspose.csproj
  7. +5
    -0
      Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/packages.config
  8. +39
    -1
      Learun.Framework.Ultimate V7/西昌单校区版V3.0.sln

+ 8
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs View File

@@ -1,6 +1,7 @@
using Learun.Application.Base.SystemModule;
using Learun.Application.OA.File.FilePreview;
using Learun.Util;
using Quanjiang.DigitalSchool.AsposeHelper;
using System.Web;
using System.Web.Mvc;

@@ -195,7 +196,8 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名
if (!DirFileHelper.IsExistFile(filepath))
{
filePreviewIBLL.GetExcelData(data.F_FilePath);
AsposeCore.GetExcelData(data.F_FilePath);
//filePreviewIBLL.GetExcelData(data.F_FilePath);
}
}
if (data.F_FileType == "docx" || data.F_FileType == "doc")
@@ -203,7 +205,8 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名
if (!DirFileHelper.IsExistFile(filepath))
{
filePreviewIBLL.GetWordData(data.F_FilePath);
AsposeCore.GetWordData(data.F_FilePath);
//filePreviewIBLL.GetWordData(data.F_FilePath);
}
}
if (data.F_FileType == "ppt" || data.F_FileType == "pptx")
@@ -211,7 +214,8 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名
if (!DirFileHelper.IsExistFile(filepath))
{
filePreviewIBLL.GetPptData(data.F_FilePath);
AsposeCore.GetWordData(data.F_FilePath);
//filePreviewIBLL.GetPptData(data.F_FilePath);
}
}
Response.ClearContent();
@@ -264,6 +268,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
break;
}
Response.Charset = "GB2312";
Response.Charset = "utf-8"; //修改txt文件预览乱码
Response.WriteFile(filepath);
//Response.BinaryWrite(ms.ToArray());
}


+ 3
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Global.asax.cs View File

@@ -6,6 +6,7 @@ using System.Web.Routing;
using Hangfire;
using Learun.Application.Extention.TaskScheduling;
using Learun.Application.WorkFlow;
using Quanjiang.DigitalSchool.AsposeHelper;

namespace Learun.Application.Web
{
@@ -37,6 +38,8 @@ namespace Learun.Application.Web
//cache.RemoveAll(6);
WfJobScheduler.Start();
QuartzHelper.InitJob();
//执行aspose初始化
AsposeCore.AsposeCoreInit();
}

/// <summary>


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj View File

@@ -7184,6 +7184,10 @@
<Project>{4D841EAD-3FD8-4FAC-BC67-C4CE6C0D1181}</Project>
<Name>Quanjiang.DigitalScholl.WebLicense</Name>
</ProjectReference>
<ProjectReference Include="..\Quanjiang.DigitalSchool.Aspose\Quanjiang.DigitalSchool.Aspose.csproj">
<Project>{767d20c4-b983-4940-bf97-74d5479ca558}</Project>
<Name>Quanjiang.DigitalSchool.Aspose</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Areas\LR_OrganizationModule\Views\User\StudentIndex.cshtml" />


+ 60
- 0
Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/AsposeCore.cs View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells;
using Aspose.Words;
using Learun.Util;
using SaveFormat = Aspose.Words.SaveFormat;

namespace Quanjiang.DigitalSchool.AsposeHelper
{
public class AsposeCore
{
public static void AsposeCoreInit()
{
new Aspose.Words.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4yMDA2MDIwMTI2MzM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+OTM2ZTVmZDEtODY2Mi00YWJmLTk1YmQtYzhkYzBmNTNhZmE2PC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXh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AgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+OTM2ZTVmZDEtODY2Mi00YWJmLTk1YmQtYzhkYzBmNTNhZmE2PC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjEwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT5wSkpjQndRdnYxV1NxZ1kyOHFJYUFKSysvTFFVWWRrQ2x5THE2RUNLU0xDQ3dMNkEwMkJFTnh5L3JzQ1V3UExXbjV2bTl0TDRQRXE1aFAzY2s0WnhEejFiK1JIWTBuQkh1SEhBY01TL1BSeEJES0NGbWg1QVFZRTlrT0FxSzM5NVBSWmJRSGowOUNGTElVUzBMdnRmVkp5cUhjblJvU3dPQnVqT1oyeDc4WFE9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
}
public static void GetWordData(string path)
{
try
{
Document document = new Document(path);
document.Save(path.Substring(0, path.LastIndexOf(".")) + ".pdf",SaveFormat.Pdf);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
public static void GetExcelData(string path)
{
try
{
Workbook document = new Workbook(path);
document.Save(path.Substring(0, path.LastIndexOf(".")) + ".pdf", Aspose.Cells.SaveFormat.Pdf);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
}
}

+ 36
- 0
Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/Properties/AssemblyInfo.cs View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Quanjiang.DigitalSchool.Aspose")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Quanjiang.DigitalSchool.Aspose")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("767d20c4-b983-4940-bf97-74d5479ca558")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 0
- 1
Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/Quanjiang.DigitalSchool.Aspose.csproj View File

@@ -55,7 +55,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>


+ 5
- 0
Learun.Framework.Ultimate V7/Quanjiang.DigitalSchool.Aspose/packages.config View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Aspose.Cells" version="20.10.0" targetFramework="net461" />
<package id="Aspose.Words" version="20.10.0" targetFramework="net461" />
</packages>

+ 39
- 1
Learun.Framework.Ultimate V7/西昌单校区版V3.0.sln View File

@@ -126,6 +126,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quanjiang.DigitalSchool.IMS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quanjiang.DigitalScholl.Tools", "Quanjiang.Application.Tools\Quanjiang.DigitalScholl.Tools.csproj", "{E17E5ACC-AF20-45EB-8A78-6DC07C9E01D0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quanjiang.DigitalSchool.Aspose", "Quanjiang.DigitalSchool.Aspose\Quanjiang.DigitalSchool.Aspose.csproj", "{767D20C4-B983-4940-BF97-74D5479CA558}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Android = Debug|Android
@@ -1624,6 +1626,42 @@ Global
{E17E5ACC-AF20-45EB-8A78-6DC07C9E01D0}.Release|Windows-x64.Build.0 = Release|Any CPU
{E17E5ACC-AF20-45EB-8A78-6DC07C9E01D0}.Release|Windows-x86.ActiveCfg = Release|Any CPU
{E17E5ACC-AF20-45EB-8A78-6DC07C9E01D0}.Release|Windows-x86.Build.0 = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Android.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Android.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Any CPU.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|iOS.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|iOS.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Windows-ARM.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Windows-ARM.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Windows-x64.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Windows-x64.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Windows-x86.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Debug|Windows-x86.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Android.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Android.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Any CPU.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Any CPU.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|iOS.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|iOS.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Windows-ARM.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Windows-ARM.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Windows-x64.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Windows-x64.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Windows-x86.ActiveCfg = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Development|Windows-x86.Build.0 = Debug|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Android.ActiveCfg = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Android.Build.0 = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Any CPU.ActiveCfg = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Any CPU.Build.0 = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|iOS.ActiveCfg = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|iOS.Build.0 = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Windows-ARM.ActiveCfg = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Windows-ARM.Build.0 = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Windows-x64.ActiveCfg = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Windows-x64.Build.0 = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Windows-x86.ActiveCfg = Release|Any CPU
{767D20C4-B983-4940-BF97-74D5479CA558}.Release|Windows-x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1675,7 +1713,7 @@ Global
{E05A2B9A-A939-450F-9A44-A8B3201D055A} = {ED258CD0-0A0C-490B-9D8F-B4CEC4467251}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
SolutionGuid = {968C278F-4142-4DFF-96B0-B3D70A649451}
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
EndGlobalSection
EndGlobal

Loading…
Cancel
Save