修改导表
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
310c4a0f70
commit
e9c6d123d3
|
|
@ -18,6 +18,7 @@ using NPOI.HSSF.UserModel;
|
||||||
using NPOI.SS.Formula.Functions;
|
using NPOI.SS.Formula.Functions;
|
||||||
using NPOI.SS.UserModel;
|
using NPOI.SS.UserModel;
|
||||||
using NPOI.XSSF.UserModel;
|
using NPOI.XSSF.UserModel;
|
||||||
|
using SharpCompress.Common;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Xceed.Document.NET;
|
using Xceed.Document.NET;
|
||||||
|
|
@ -870,17 +871,16 @@ public static class ExcelExportHelper
|
||||||
//模板路径
|
//模板路径
|
||||||
var tplPath = physicalPath;
|
var tplPath = physicalPath;
|
||||||
|
|
||||||
#region 根据中英文 删除模板sheet
|
|
||||||
|
|
||||||
// 打开模板文件
|
|
||||||
var templateFile = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
|
|
||||||
|
|
||||||
// 获取文件流
|
// 获取文件流
|
||||||
var templateStream = new MemoryStream();
|
var templateStream = new MemoryStream();
|
||||||
templateFile.CopyTo(templateStream);
|
|
||||||
templateStream.Seek(0, SeekOrigin.Begin);
|
|
||||||
|
|
||||||
var workbook = new XSSFWorkbook(templateStream);
|
#region 根据中英文 删除模板sheet
|
||||||
|
|
||||||
|
// 打开模板文件
|
||||||
|
var templateFileStream = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
|
var workbook = new XSSFWorkbook(templateFileStream);
|
||||||
|
|
||||||
int sheetCount = workbook.NumberOfSheets;
|
int sheetCount = workbook.NumberOfSheets;
|
||||||
|
|
||||||
|
|
@ -985,14 +985,8 @@ public static class ExcelExportHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var memoryStream2 = new MemoryStream())
|
workbook.Write(templateStream, leaveOpen: true);
|
||||||
{
|
templateStream.Position = 0;
|
||||||
workbook.Write(memoryStream2, true);
|
|
||||||
|
|
||||||
memoryStream2.Seek(0, SeekOrigin.Begin);
|
|
||||||
|
|
||||||
templateStream = memoryStream2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1099,6 +1093,63 @@ public static class ExcelExportHelper
|
||||||
//模板路径
|
//模板路径
|
||||||
var tplPath = physicalPath;
|
var tplPath = physicalPath;
|
||||||
|
|
||||||
|
var templateStream = new MemoryStream();
|
||||||
|
|
||||||
|
|
||||||
|
#region npoi 移除某一行
|
||||||
|
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
if (isEn_US)
|
||||||
|
{
|
||||||
|
// 打开模板文件
|
||||||
|
using var templateFileStream = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
|
using var workbook = new XSSFWorkbook(templateFileStream);
|
||||||
|
|
||||||
|
int sheetCount = workbook.NumberOfSheets;
|
||||||
|
|
||||||
|
int removeRowIndex = 1; // 要删除的行(0-based)
|
||||||
|
|
||||||
|
for (int i = 0; i < sheetCount; i++)
|
||||||
|
{
|
||||||
|
var sheet = workbook.GetSheetAt(i);
|
||||||
|
|
||||||
|
// 2️ 删除行
|
||||||
|
var row = sheet.GetRow(removeRowIndex);
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
sheet.RemoveRow(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3️ 上移后续行
|
||||||
|
if (removeRowIndex < sheet.LastRowNum)
|
||||||
|
{
|
||||||
|
sheet.ShiftRows(
|
||||||
|
removeRowIndex + 1,
|
||||||
|
sheet.LastRowNum,
|
||||||
|
-1,
|
||||||
|
true, // copyRowHeight
|
||||||
|
false // resetOriginalRowHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
workbook.Write(templateStream, leaveOpen: true);
|
||||||
|
templateStream.Position = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (var fs = new FileStream(tplPath, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
fs.CopyTo(templateStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
templateStream.Position = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
var memoryStream = new MemoryStream();
|
var memoryStream = new MemoryStream();
|
||||||
|
|
||||||
|
|
@ -1107,7 +1158,7 @@ public static class ExcelExportHelper
|
||||||
IgnoreTemplateParameterMissing = true,
|
IgnoreTemplateParameterMissing = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
await MiniExcel.SaveAsByTemplateAsync(memoryStream, tplPath, data, config);
|
await MiniExcel.SaveAsByTemplateAsync(memoryStream, templateStream.ToArray(), data, config);
|
||||||
|
|
||||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -601,6 +601,8 @@ public class Tumor_CDISC_ExportService(IRepository<ReadingQuestionCriterionTrial
|
||||||
|
|
||||||
#region tu 表处理部分
|
#region tu 表处理部分
|
||||||
|
|
||||||
|
if (!tuList.Any(t => t.SubjectCode == task.SubjectCode && t.ARM_TumorNo == $"{task.ArmEnumStr}_{lesion.LessionCode}"))
|
||||||
|
{
|
||||||
var tu = CreatNewTUExport(task, lesion, visitIndexNoDic, translateDataList, isEn_Us);
|
var tu = CreatNewTUExport(task, lesion, visitIndexNoDic, translateDataList, isEn_Us);
|
||||||
|
|
||||||
if (lesion.OrganInfoId.HasValue)
|
if (lesion.OrganInfoId.HasValue)
|
||||||
|
|
@ -612,6 +614,7 @@ public class Tumor_CDISC_ExportService(IRepository<ReadingQuestionCriterionTrial
|
||||||
Fill_Resisit_Lugano_TUExport(tu, lesion);
|
Fill_Resisit_Lugano_TUExport(tu, lesion);
|
||||||
|
|
||||||
tuList.Add(tu);
|
tuList.Add(tu);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue