SVN r746
SVN-Revision: r746
This commit is contained in:
@@ -290,7 +290,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
try
|
||||
{
|
||||
if (control is TreeGridControlEx)
|
||||
if (control is TreeGridControlEx)
|
||||
{
|
||||
return ((control as TreeGridControlEx).TreeListObj.DataSource as DataTable).Rows.Count;
|
||||
}
|
||||
@@ -1354,7 +1354,50 @@ namespace Lskj.Control.Model
|
||||
string fileExt = Path.GetExtension(dialog.FileName).ToLower();
|
||||
|
||||
// 创建导出选项
|
||||
XlsExportOptions options = new XlsExportOptions();
|
||||
XlsExportOptionsEx xlsOptionsEx = new XlsExportOptionsEx();
|
||||
xlsOptionsEx.CustomizeCell += (e) =>
|
||||
{
|
||||
GridView mainView = newControl.MainView as GridView;
|
||||
DataRow dataRow = mainView.GetDataRow(e.DataSourceRowIndex);
|
||||
GridColumn gridColumn = mainView.Columns[e.ColumnFieldName];
|
||||
string urlName = "";
|
||||
if (gridColumn.ColumnEdit != null && gridColumn.ColumnEdit is RepositoryItemHyperLinkEdit repositoryItemHyperLinkEdit)
|
||||
{
|
||||
GridColumnModel model = repositoryItemHyperLinkEdit.Tag as GridColumnModel;
|
||||
urlName = model.ValueMember;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(e.Hyperlink) && dataRow != null && !string.IsNullOrEmpty(urlName))
|
||||
{
|
||||
string linkStr = dataRow.Table.Columns.Contains(urlName) ? dataRow[urlName] + "" : "";
|
||||
if (!string.IsNullOrEmpty(linkStr))
|
||||
{
|
||||
e.Hyperlink = linkStr;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
XlsxExportOptionsEx xlsxoptionsEx = new XlsxExportOptionsEx();
|
||||
xlsxoptionsEx.CustomizeCell += (e) =>
|
||||
{
|
||||
GridView mainView = newControl.MainView as GridView;
|
||||
DataRow dataRow = mainView.GetDataRow(e.DataSourceRowIndex);
|
||||
GridColumn gridColumn = mainView.Columns[e.ColumnFieldName];
|
||||
string urlName = "";
|
||||
if (gridColumn.ColumnEdit != null && gridColumn.ColumnEdit is RepositoryItemHyperLinkEdit repositoryItemHyperLinkEdit)
|
||||
{
|
||||
GridColumnModel model = repositoryItemHyperLinkEdit.Tag as GridColumnModel;
|
||||
urlName = model.ValueMember;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(e.Hyperlink) && dataRow != null && !string.IsNullOrEmpty(urlName))
|
||||
{
|
||||
string linkStr = dataRow.Table.Columns.Contains(urlName) ? dataRow[urlName] + "" : "";
|
||||
if (!string.IsNullOrEmpty(linkStr))
|
||||
{
|
||||
e.Hyperlink = linkStr;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
// 设置导出时不包含筛选信息
|
||||
//options.ExportFilterInfo = false;
|
||||
|
||||
@@ -1388,12 +1431,12 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
newControl.ExportToXls(dialog.FileName);
|
||||
newControl.ExportToXls(dialog.FileName, xlsOptionsEx);
|
||||
//control.ExportToXls(dialog.FileName);
|
||||
}
|
||||
break;
|
||||
case ".xlsx":
|
||||
newControl.ExportToXlsx(dialog.FileName);
|
||||
newControl.ExportToXlsx(dialog.FileName, xlsxoptionsEx);
|
||||
break;
|
||||
case ".pdf":
|
||||
//link.ExportToPdf(dialog.FileName);
|
||||
@@ -1958,7 +2001,7 @@ namespace Lskj.Control.Model
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2105,14 +2148,14 @@ namespace Lskj.Control.Model
|
||||
continue;
|
||||
}
|
||||
|
||||
if(SystemInfo.Instance.ImportRemoveSpaces && cell.CellType == CellType.String)
|
||||
if (SystemInfo.Instance.ImportRemoveSpaces && cell.CellType == CellType.String)
|
||||
{
|
||||
// 清除字符串前后空格
|
||||
string cellValue = cell.StringCellValue.Trim();
|
||||
cell.SetCellValue(cellValue);
|
||||
}
|
||||
|
||||
if ((model.ImportConversionFormat+"").Equals("1"))
|
||||
if ((model.ImportConversionFormat + "").Equals("1"))
|
||||
{
|
||||
// 转成全大写
|
||||
string cellValue = cell.StringCellValue.ToUpper();
|
||||
|
||||
Reference in New Issue
Block a user