55 lines
2.1 KiB
C#
55 lines
2.1 KiB
C#
using YieldChain.Helpers;
|
|
using YLErp.Office.Converters;
|
|
|
|
namespace YLErp.PluginTests
|
|
{
|
|
[TestClass]
|
|
public class TestFormatConverter
|
|
{
|
|
[TestMethod("测试转PDF")]
|
|
public void Test()
|
|
{
|
|
string templatePath, targetPath;
|
|
|
|
Directory.CreateDirectory(Path.Combine(AppContext.BaseDirectory, "temp"));
|
|
|
|
templatePath = Path.Combine(AppContext.BaseDirectory, "Resources\\PluginTests\\BanXing\\交易确认书模板.docx");
|
|
|
|
targetPath = Path.Combine(AppContext.BaseDirectory, "temp\\交易确认书模板..pdf");
|
|
|
|
OfficeFileConverter.ConvertFileFormat(templatePath, targetPath);
|
|
|
|
//targetPath = Path.Combine(AppContext.BaseDirectory, "temp\\交易确认书模板.pdf");
|
|
//MsWordFormatConverter.ConvertToPDF(templatePath, targetPath);
|
|
|
|
//-------------------------------------
|
|
|
|
templatePath = Path.Combine(AppContext.BaseDirectory, "Resources\\RealtimeRiskTest_计算结果对照.xlsx");
|
|
|
|
targetPath = Path.Combine(AppContext.BaseDirectory, "temp\\RealtimeRiskTest_计算结果对照.pdf");
|
|
|
|
OfficeFileConverter.ConvertFileFormat(templatePath, targetPath);
|
|
|
|
//targetPath = Path.Combine(AppContext.BaseDirectory, "temp\\RealtimeRiskTest_计算结果对照2.pdf");
|
|
|
|
//MsExcelFormatConverter.ConvertToPDF(templatePath, targetPath);
|
|
}
|
|
|
|
[TestMethod("测试-结算确认书模板")]
|
|
public void Test2()
|
|
{
|
|
var templatePath = Path.Combine(AppContext.BaseDirectory, "Resources\\PluginTests\\国信金阳期权交易确认书_亚式增强_看跌.docx");
|
|
|
|
var targetPath = Path.Combine("d:\\temp\\", "国信金阳期权交易确认书_亚式增强_看跌2.docx");
|
|
|
|
var varDic = new JsonVarDic();
|
|
|
|
varDic.SetVar("交易编号", "我是客户AAA");
|
|
|
|
OfficeFileConverter.ConvertByUsingDocTemplate(templatePath, targetPath, varDic);
|
|
|
|
OfficeFileConverter.ConvertDocxToPDF(targetPath,FileHelper.ReplaceExtension(targetPath,".pdf"));
|
|
}
|
|
}
|
|
}
|