本文整理汇总了C#中TreeList.ExportToXls方法的典型用法代码示例。如果您正苦于以下问题:C# TreeList.ExportToXls方法的具体用法?C# TreeList.ExportToXls怎么用?C# TreeList.ExportToXls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeList
的用法示例。
在下文中一共展示了TreeList.ExportToXls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportToExcel
public static string ExportToExcel(TreeList treeView, TextExportMode exportMode)
{
try
{
var fileName = GetSaveExcelFileName();
var extension = Path.GetExtension(fileName);
if (extension == ".xls")
{
treeView.ExportToXls(fileName,
new XlsExportOptions(
exportMode, true));
}
else if (extension == ".xlsx")
{
treeView.ExportToXlsx(fileName,
new XlsxExportOptions(
exportMode, true));
}
else
{
return "";
}
return fileName;
}
catch
{
}
return "";
}
示例2: exportFile
public static bool exportFile(TreeList treeList, String ext)
{
bool flag = false;
bool succ = false;
string filePath = null;
try
{
SaveFileDialog f = new SaveFileDialog();
f.Title = "Chọn tên tập tin muốn lưu";
if (ext.Equals("xls"))
f.Filter = "Excel 97 - 2003 files (*.xls)|*.xls";
else if (ext.Equals("xlsx"))
f.Filter = "Excel 2007 files (*.xlsx)|*.xlsx";
else if (ext.Equals("pdf"))
f.Filter = "PDF (*.pdf)|*.pdf";
else if (ext.Equals("htm"))
f.Filter = "Web Pages (*.htm)|*.htm";
else if (ext.Equals("rtf"))
f.Filter = "Rich Text files (*.rtf)|*.rtf";
f.ShowDialog();
if (f.FileName != "")
{
filePath = f.FileName;
if (FrameworkParams.wait == null)
{
FrameworkParams.wait = new WaitingMsg();
flag = true;
}
if (ext.Equals("xls"))
{
treeList.ExportToXls(f.FileName);
succ = true;
}
else if (ext.Equals("xlsx"))
{
treeList.ExportToXlsx(f.FileName);
succ = true;
}
else if (ext.Equals("pdf"))
{
treeList.ExportToPdf(f.FileName);
succ = true;
}
else if (ext.Equals("rtf"))
{
treeList.ExportToRtf(f.FileName);
succ = true;
}
else if (ext.Equals("htm"))
{
treeList.ExportToHtml(f.FileName);
succ = true;
}
}
}
catch (Exception ex)
{
PLException.AddException(ex);
return false;
}
finally
{
if (FrameworkParams.wait != null && flag == true)
FrameworkParams.wait.Finish();
if (succ == true)
{
if (PLMessageBox.ShowConfirmMessage("Bạn có muốn mở tập tin này không?") == DialogResult.Yes)
{
if (!HelpFile.OpenFile(filePath))
HelpMsgBox.ShowNotificationMessage("Mở tập tin không thành công");
}
}
}
return true;
}