Commit f7619c33 by 刘军

添加报告导出层。

parent e2efb556
......@@ -59,6 +59,15 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Spire.Doc, Version=7.12.23.4046, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
<HintPath>..\packages\Spire.Doc.7.12.23\lib\net46\Spire.Doc.dll</HintPath>
</Reference>
<Reference Include="Spire.License, Version=1.3.8.46, Culture=neutral, PublicKeyToken=b1144360237c8b3f, processorArchitecture=MSIL">
<HintPath>..\packages\Spire.Doc.7.12.23\lib\net46\Spire.License.dll</HintPath>
</Reference>
<Reference Include="Spire.Pdf, Version=5.12.16.18046, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
<HintPath>..\packages\Spire.Doc.7.12.23\lib\net46\Spire.Pdf.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.1.2.6\lib\net46\StackExchange.Redis.dll</HintPath>
</Reference>
......@@ -76,6 +85,12 @@
<Reference Include="WorkFlow">
<HintPath>..\DLL\WorkFlow.dll</HintPath>
</Reference>
<Reference Include="Xceed.Document.NET, Version=1.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\DocX.1.5.0\lib\net40\Xceed.Document.NET.dll</HintPath>
</Reference>
<Reference Include="Xceed.Words.NET, Version=1.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\DocX.1.5.0\lib\net40\Xceed.Words.NET.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Chloe.Extension\DbActionBag.cs" />
......@@ -149,6 +164,9 @@
<ItemGroup>
<Content Include="Chloe.Extension\Chloe.Extension.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Word\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DocX" version="1.5.0" targetFramework="net46" />
<package id="JWT" version="5.2.2" targetFramework="net46" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="Spire.Doc" version="7.12.23" targetFramework="net46" />
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net46" />
</packages>
\ No newline at end of file
......@@ -43,8 +43,8 @@ namespace G.MES.API.Controllers
{
try
{
return ClientInfo.DoGetClientInfoDetail(ClientInfoOID);
List<Guid> ClientInfosOID = new List<Guid>() { ClientInfoOID };
return ClientInfo.DoGetClientInfoDetail(ClientInfosOID).FirstOrDefault();
}
catch (Exception ex)
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace G.MES.API.Controllers
{
/// <summary>
/// 报告导出
/// </summary>
public class ExportWordController
{
/// <summary>
/// 获取所选人的报告
/// </summary>
/// <param name="ClientInfosOID"></param>
/// <returns></returns>
public string GetCurrentReport(List<Guid> ClientInfosOID)
{
return "";
}
}
}
\ No newline at end of file
......@@ -256,6 +256,7 @@
<Compile Include="Controllers\LoginController.cs" />
<Compile Include="Controllers\MISReportController.cs" />
<Compile Include="Controllers\PMIDController.cs" />
<Compile Include="Controllers\ExportWordController.cs" />
<Compile Include="Controllers\SampleControlController.cs" />
<Compile Include="Controllers\SampleTypeController.cs" />
<Compile Include="Controllers\SystemController.cs" />
......@@ -914,6 +915,7 @@
<Content Include="packages\WebGrease.1.6.0\WebGrease.1.6.0.nupkg" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="readme.md" />
<None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" />
......
## 刘军修改
### 一、新建化疗结果表
> 字段:药物方案、基因、检测位点、基因型、用药提示、级别
```
CREATE TABLE [dbo].[Chemotherapy](
[ChemotherapyOID] [UNIQUEIDENTIFIER] NOT NULL,
[DrugPlan] [VARCHAR](50) NULL,
[Gene] [VARCHAR](50) NULL,
[TestSite] [VARCHAR](50) NULL,
[Genotype] [VARCHAR](50) NULL,
[MedicationPrompts] [TEXT] NULL,
[Levels] [VARCHAR](50) NULL,
CONSTRAINT [PK_Chemotherapy] PRIMARY KEY CLUSTERED
(
[ChemotherapyOID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
```
......@@ -95,6 +95,7 @@
<Compile Include="Services\ChemicalDrugReferencesSVC\ChemicalDrugReferencesSVC.cs" />
<Compile Include="Services\ClientInfoSVC\ClientInfoSVC.cs" />
<Compile Include="Services\CodeTableSVC\CodeTableOperaSVC.cs" />
<Compile Include="Services\ExportWordSVC\ReportDataSvc.cs" />
<Compile Include="Services\GeneCorrelationSVC\GeneCorrelationSVC.cs" />
<Compile Include="Services\GeneDetectionResultSVC\GeneDetectionResultSVC.cs" />
<Compile Include="Services\GeneSVC\GeneSVC.cs" />
......
......@@ -19,13 +19,14 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
public class ClientInfoSVC : BaseSvc
{
#region 获取详情
public ClientInfoDetailModel DoGetClientInfoDetail(Guid requestModel)
public List<ClientInfoDetailModel> DoGetClientInfoDetail(List<Guid> requestModel)
{
try
{
using (var context = new MsSqlContext(sqlConn))
{
ClientInfoDetailModel thisQueryModel = context.Query<ClientInfo>().Where(a => a.ClientInfoOID == requestModel)
List<ClientInfoDetailModel> thisQueryModel = context.Query<ClientInfo>().Where(a => requestModel.Contains(a.ClientInfoOID))
.Select(a => new ClientInfoDetailModel
{
ClientInfoOID = a.ClientInfoOID,
......@@ -45,8 +46,7 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
FamilyHistory = a.FamilyHistory,
PersonalHistory = a.PersonalHistory,
SamplingTime = a.SamplingTime
}).FirstOrDefault();
}).ToList();
return thisQueryModel;
}
}
......
using Chloe;
using Chloe.SqlServer;
using G.Buss.BaseInfo.ViewModel.ClientInfoModel;
using G.Buss.BaseInfo.ViewModel.GeneticRisksModel;
using G.Buss.BaseInfo.ViewModel.MISReportModel;
using G.Buss.BaseInfo.ViewModel.SampleControlModel;
using G.Buss.BaseInfo.ViewModel.TMBGradeRequestModel;
using G.MES.DataModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace G.Buss.BaseInfo.Services.ExportWordSVC
{
public class ReportDataSvc : BaseSvc
{
public readonly ClientInfoSVC.ClientInfoSVC ClientInfo = new ClientInfoSVC.ClientInfoSVC();
/// <summary>
/// 获取需要导出的受试者集合
/// </summary>
/// <param name="ClientInfosOID"></param>
public List<ClientInfoDetailModel> GetClirntInfo(List<Guid> ClientInfosOID)
{
return ClientInfo.DoGetClientInfoDetail(ClientInfosOID);
}
/// <summary>
/// 获取TMB等级说明
/// </summary>
public List<TMBGradeQueryModel> GetTMBLevel()
{
using (var context = new MsSqlContext(sqlConn))
{
List<TMBGradeQueryModel> TMBGradeQuery = context.JoinQuery<TMBGrade, Sys_Organize>((TMBGrade, org) => new object[] {
JoinType.LeftJoin,TMBGrade.SYS_ORG == org.Sys_OrganizeOID
}).Select((TMBGrade, org) => new TMBGradeQueryModel
{
TMBGradeOID = TMBGrade.TMBGradeOID,
Grade = TMBGrade.Grade,
Scope = TMBGrade.Scope,
Remark = TMBGrade.Remark,
ClassCode = org.ClassCode
}).ToList();
return TMBGradeQuery;
}
}
/// <summary>
/// 获取MIS结果提示
/// </summary>
public List<MISReportQueryModel> GetMIS()
{
using (var context = new MsSqlContext(sqlConn))
{
List<MISReportQueryModel> MISReportQuery = context.JoinQuery<MISReport, Sys_Organize>((MISReport, org) => new object[] {
JoinType.LeftJoin,MISReport.SYS_ORG == org.Sys_OrganizeOID
}).Select((MISReport, org) => new MISReportQueryModel
{
MISReportOID = MISReport.MISReportOID,
Grade = MISReport.Grade,
Scope = MISReport.Scope,
Remark = MISReport.Remark,
ClassCode = org.ClassCode
}).ToList();
int TotalNum = MISReportQuery.Count();
return MISReportQuery;
}
}
/// <summary>
/// 获取检测结果
/// </summary>
public void GetCheckResult()
{
}
/// <summary>
/// 获取化疗药物
/// </summary>
public void GetChemotherapyDrugs()
{
}
/// <summary>
/// 获取遗传风险
/// </summary>
public List<GeneticRisksQueryModel> GeneticRisk()
{
using (var context = new MsSqlContext(sqlConn))
{
List<GeneticRisksQueryModel> GeneticRisksQuery = context.JoinQuery<GeneticRisks, Sys_Organize>((GeneticRisks, org) => new object[] {
JoinType.LeftJoin,GeneticRisks.SYS_ORG == org.Sys_OrganizeOID
}).Select((GeneticRisks, org) => new GeneticRisksQueryModel
{
GeneticRisksOID = GeneticRisks.GeneticRisksOID,
SampleCode = GeneticRisks.SampleCode,
GeneName = GeneticRisks.GeneName,
Mutations = GeneticRisks.Mutations,
MutationType = GeneticRisks.MutationType,
Heterozygosity = GeneticRisks.Heterozygosity,
RiskAssessment = GeneticRisks.RiskAssessment,
ClassCode = org.ClassCode
}).ToList();
return GeneticRisksQuery;
}
}
/// <summary>
/// 获取样本质控情况
/// </summary>
public List<SampleControlQueryModel> GetSampleQuality()
{
using (var context = new MsSqlContext(sqlConn))
{
List<SampleControlQueryModel> SampleControlQuery = context.JoinQuery<SampleControl, Sys_Organize>((SampleControl, org) => new object[] {
JoinType.LeftJoin,SampleControl.SYS_ORG == org.Sys_OrganizeOID
}).Select((SampleControl, org) => new SampleControlQueryModel
{
SampleControlOID = SampleControl.SampleControlOID,
ControlStep = SampleControl.ControlStep,
ControlResult = SampleControl.ControlResult,
SortNo = SampleControl.SortNo,
ClassCode = org.ClassCode
}).ToList();
return SampleControlQuery;
}
}
/// <summary>
/// 获取靶药参考文献
/// </summary>
public string GetTargetDrugReferences()
{
using (var context = new MsSqlContext(sqlConn))
{
try
{
string TargetedMedicineReferencesTxt = context.Query<TargetedMedicineReferences>().Select(a => a.TargetedMedicineReferencesTxt).FirstOrDefault();
if (TargetedMedicineReferencesTxt == null)
{
TargetedMedicineReferencesTxt = "";
}
return TargetedMedicineReferencesTxt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
/// <summary>
/// 获取基因列表
/// </summary>
public void GetGeneList()
{
}
/// <summary>
/// 获取化药参考文献
/// </summary>
public string GetChemicalMdicineReferences()
{
using (var context = new MsSqlContext(sqlConn))
{
try
{
string ChemicalDrugReferencesTxt = context.Query<ChemicalDrugReferences>().Select(a => a.ChemicalDrugReferencesTxt).FirstOrDefault();
if (ChemicalDrugReferencesTxt == null)
{
ChemicalDrugReferencesTxt = "";
}
return ChemicalDrugReferencesTxt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}
}
......@@ -61,6 +61,9 @@
<Compile Include="ChemicalDrugReferences.cs">
<DependentUpon>DataTemplete.tt</DependentUpon>
</Compile>
<Compile Include="Chemotherapy.cs">
<DependentUpon>DataTemplete.tt</DependentUpon>
</Compile>
<Compile Include="ClientInfo.cs">
<DependentUpon>DataTemplete.tt</DependentUpon>
</Compile>
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码是根据模板生成的。
//
// 手动更改此文件可能会导致应用程序中发生异常行为。
// 如果重新生成代码,则将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------
namespace G.MES.DataModel
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Chloe.Annotations;
///<summary><summary>
[Serializable]
public partial class Chemotherapy : Core.BaseModel
{
///<summary><summary>
[ColumnAttribute(IsPrimaryKey = true)]
public virtual System.Guid ChemotherapyOID { get;set; }
///<summary><summary>
public virtual string DrugPlan { get;set; }
///<summary><summary>
public virtual string Gene { get;set; }
///<summary><summary>
public virtual string TestSite { get;set; }
///<summary><summary>
public virtual string Genotype { get;set; }
///<summary><summary>
public virtual string MedicationPrompts { get;set; }
///<summary><summary>
public virtual string Levels { get;set; }
}
}
......@@ -13,7 +13,7 @@
</defaultConnectionFactory>
</entityFramework>
<connectionStrings>
<add name="DbModelEntities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=SYSMANAGE;persist security info=True;user id=sa;password=123456;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="DbModelEntities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=JCBB_MB;persist security info=True;user id=sa;password=P@ssw0rd;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
<runtime>
......
......@@ -63,5 +63,6 @@ namespace G.MES.DataAdapter
public DbSet<CodeValue> CodeValue { get; set; }
public DbSet<Gene> Gene { get; set; }
public DbSet<ClientInfo> ClientInfo { get; set; }
public DbSet<Chemotherapy> Chemotherapy { get; set; }
}
}
// 为模型“D:\Project\NEWAPI\3.SourceCode\SDAPI\G.MES.DbAdapter\DbModel.edmx”启用了 T4 代码生成。
// 为模型“F:\Work\Project\报告系统\Git\ReportingSystemAPI\G.MES.DbAdapter\DbModel.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时,此属性会出现在
// “属性”窗口中。
......
......@@ -28,6 +28,18 @@
<Property Name="SYS_ORG" Type="uniqueidentifier" />
<Property Name="SYS_LAST_UPD_BY" Type="uniqueidentifier" />
</EntityType>
<EntityType Name="Chemotherapy">
<Key>
<PropertyRef Name="ChemotherapyOID" />
</Key>
<Property Name="ChemotherapyOID" Type="uniqueidentifier" Nullable="false" />
<Property Name="DrugPlan" Type="varchar" MaxLength="50" />
<Property Name="Gene" Type="varchar" MaxLength="50" />
<Property Name="TestSite" Type="varchar" MaxLength="50" />
<Property Name="Genotype" Type="varchar" MaxLength="50" />
<Property Name="MedicationPrompts" Type="text" />
<Property Name="Levels" Type="varchar" MaxLength="50" />
</EntityType>
<EntityType Name="ClientInfo">
<Key>
<PropertyRef Name="ClientInfoOID" />
......@@ -559,6 +571,7 @@
<EntityContainer Name="DbModelStoreContainer">
<EntitySet Name="AutoIncReccord" EntityType="Self.AutoIncReccord" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ChemicalDrugReferences" EntityType="Self.ChemicalDrugReferences" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Chemotherapy" EntityType="Self.Chemotherapy" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ClientInfo" EntityType="Self.ClientInfo" Schema="dbo" store:Type="Tables" />
<EntitySet Name="CodeClassify" EntityType="Self.CodeClassify" Schema="dbo" store:Type="Tables" />
<EntitySet Name="CodeValue" EntityType="Self.CodeValue" Schema="dbo" store:Type="Tables" />
......@@ -666,6 +679,7 @@
<EntitySet Name="CodeValue" EntityType="DbModel.CodeValue" />
<EntitySet Name="Gene" EntityType="DbModel.Gene" />
<EntitySet Name="ClientInfo" EntityType="DbModel.ClientInfo" />
<EntitySet Name="Chemotherapy" EntityType="DbModel.Chemotherapy" />
</EntityContainer>
<EntityType Name="Sys_BusiPortalMenu">
......@@ -1256,6 +1270,18 @@
<Property Name="SYS_LAST_UPD_BY" Type="Guid" />
<Property Name="Remark" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="Chemotherapy">
<Key>
<PropertyRef Name="ChemotherapyOID" />
</Key>
<Property Name="ChemotherapyOID" Type="Guid" Nullable="false" />
<Property Name="DrugPlan" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Gene" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="TestSite" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Genotype" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="MedicationPrompts" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="Levels" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
......@@ -1797,6 +1823,19 @@
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Chemotherapy">
<EntityTypeMapping TypeName="DbModel.Chemotherapy">
<MappingFragment StoreEntitySet="Chemotherapy">
<ScalarProperty Name="Levels" ColumnName="Levels" />
<ScalarProperty Name="MedicationPrompts" ColumnName="MedicationPrompts" />
<ScalarProperty Name="Genotype" ColumnName="Genotype" />
<ScalarProperty Name="TestSite" ColumnName="TestSite" />
<ScalarProperty Name="Gene" ColumnName="Gene" />
<ScalarProperty Name="DrugPlan" ColumnName="DrugPlan" />
<ScalarProperty Name="ChemotherapyOID" ColumnName="ChemotherapyOID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping></edmx:Mappings>
</edmx:Runtime>
......
......@@ -43,6 +43,7 @@
<EntityTypeShape EntityType="DbModel.CodeValue" Width="1.5" PointX="11.375" PointY="4.75" />
<EntityTypeShape EntityType="DbModel.Gene" Width="1.5" PointX="11.375" PointY="9.75" />
<EntityTypeShape EntityType="DbModel.ClientInfo" Width="1.5" PointX="13.375" PointY="0.75" />
<EntityTypeShape EntityType="DbModel.Chemotherapy" Width="1.5" PointX="0.75" PointY="13.75" />
</Diagram>
</edmx:Diagrams>
......
......@@ -21,6 +21,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "G.Buss.Client", "G.MES.Busi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "G.Buss.System", "G.MES.Business\G.System\G.Buss.System.csproj", "{F03B10E6-C0E2-45F8-B274-A450E259378E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WordByDocx", "WordByDocx\WordByDocx.csproj", "{428BC45A-FE04-4F97-9DF5-B9B9F5B931B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestWord", "UnitTestWord\UnitTestWord.csproj", "{4F8330C6-BBBB-4927-A890-CB99257E3727}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -59,6 +63,14 @@ Global
{F03B10E6-C0E2-45F8-B274-A450E259378E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F03B10E6-C0E2-45F8-B274-A450E259378E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F03B10E6-C0E2-45F8-B274-A450E259378E}.Release|Any CPU.Build.0 = Release|Any CPU
{428BC45A-FE04-4F97-9DF5-B9B9F5B931B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{428BC45A-FE04-4F97-9DF5-B9B9F5B931B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{428BC45A-FE04-4F97-9DF5-B9B9F5B931B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{428BC45A-FE04-4F97-9DF5-B9B9F5B931B3}.Release|Any CPU.Build.0 = Release|Any CPU
{4F8330C6-BBBB-4927-A890-CB99257E3727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F8330C6-BBBB-4927-A890-CB99257E3727}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F8330C6-BBBB-4927-A890-CB99257E3727}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F8330C6-BBBB-4927-A890-CB99257E3727}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("UnitTestWord")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestWord")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4f8330c6-bbbb-4927-a890-cb99257e3727")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WordByDocx.Word;
namespace UnitTestWord
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
OperationFunc operation = new OperationFunc();
operation.ReplaceText();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<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>{4F8330C6-BBBB-4927-A890-CB99257E3727}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestWord</RootNamespace>
<AssemblyName>UnitTestWord</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WordByDocx\WordByDocx.csproj">
<Project>{428bc45a-fe04-4f97-9df5-b9b9f5b931b3}</Project>
<Name>WordByDocx</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net46" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net46" />
</packages>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WordByDocx
{
public class Class1
{
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WordByDocx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WordByDocx")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("428bc45a-fe04-4f97-9df5-b9b9f5b931b3")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spire.Doc;
using Xceed.Document.NET;
using Xceed.Words.NET;
namespace WordByDocx.Word
{
public class OperationFunc
{
private static string templateDic = AppDomain.CurrentDomain.BaseDirectory + "\\template\\";
public void ReplaceText()
{
Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(templateDic + "参考报告.docx");
document.Replace("#{Name}", "张三", false, true);
document.Replace("#{Phone}", "18895358744", false, true);
document.SaveToFile(templateDic + "out.docx");
using (var documentDocx = DocX.Load(templateDic + "out.docx"))
{
documentDocx.Paragraphs[0].ReplaceText("Evaluation Warning: The document was created with Spire.Doc for .NET.", "");
documentDocx.Save();
}
}
}
}
<?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>{428BC45A-FE04-4F97-9DF5-B9B9F5B931B3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WordByDocx</RootNamespace>
<AssemblyName>WordByDocx</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spire.Doc, Version=7.12.21.4046, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
<HintPath>..\packages\Spire.Doc.7.12.21\lib\net46\Spire.Doc.dll</HintPath>
</Reference>
<Reference Include="Spire.License, Version=1.3.8.46, Culture=neutral, PublicKeyToken=b1144360237c8b3f, processorArchitecture=MSIL">
<HintPath>..\packages\Spire.Doc.7.12.21\lib\net46\Spire.License.dll</HintPath>
</Reference>
<Reference Include="Spire.Pdf, Version=5.12.16.18046, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
<HintPath>..\packages\Spire.Doc.7.12.21\lib\net46\Spire.Pdf.dll</HintPath>
</Reference>
<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.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Xceed.Document.NET, Version=1.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\DocX.1.5.0\lib\net40\Xceed.Document.NET.dll</HintPath>
</Reference>
<Reference Include="Xceed.Words.NET, Version=1.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\DocX.1.5.0\lib\net40\Xceed.Words.NET.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Word\OperationFunc.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="template\参考报告.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
<Folder Include="Unit\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DocX" version="1.5.0" targetFramework="net46" />
<package id="Spire.Doc" version="7.12.21" targetFramework="net46" />
</packages>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论