二开案例.套打导出.导出Excel设置纸张方向

【依赖版本】
需要8.1.529.1(PT-146939 [8.1.0.20230309])及以上版本
【应用场景】
产品套打导出的Excel默认的纸张方向是纵向的,部分客户想导出的Excel的方向变为横向。
【案例演示】
采购合同套打导出Excel的纸张方向为横向。
【案例演示】
<1>编写列表插件,代码如下。
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Util;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
namespace Kingdee.BOS.PlugInTest
{
/// <summary>
/// 【列表插件】套打导出Excel设置纸张方向(NPOI)
/// </summary>
[Description("【列表插件】套打导出Excel设置纸张方向(NPOI)"), HotUpdate]
public class ExportExcelPlugIn2 : AbstractListPlugIn
{
private HashSet<string> _hash = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public ExportExcelPlugIn2()
{
//_hash.Add(".xls");
_hash.Add(".xlsx");
}
/// <summary>
/// 重写套打导出结束事件
/// </summary>
/// <param name="e"></param>
public override void OnAfterPrintExport(AfterPrintExportEventArgs e)
{
// 检查数据是否存在
if (e != null && e.ExportInfo != null && e.ExportInfo.ExportFileInfos != null && e.ExportInfo.ExportFileInfos.Count > 0)
{
// 循环导出文件
foreach (var exportFileInfo in e.ExportInfo.ExportFileInfos)
{
// 检查文档是否存在
if (File.Exists(exportFileInfo.FilePath))
{
string extensionName = Path.GetExtension(exportFileInfo.FilePath);
// 只处理Excel
if (this._hash.Contains(extensionName) == false)
二开案例.套打导出.导出Excel设置纸张方向
【依赖版本】需要8.1.529.1(PT-146939 [8.1.0.20230309])及以上版本【应用场景】 产品套打导出的Excel默认的纸张方向是纵向的,部分客户想...
点击下载文档文档为doc格式
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
上一篇
已经是第一篇



