修改 ExportSelection() 方法中的条件分支语句

在本节中,将学习如何为每个 ExportFormatType 条件分支语句设置文件名字符串。

内容参考:修改 ExportSelection() 方法中的条件分支语句

修改 ExportSelection() 方法中的条件分支语句

  1. 在 ExportSelection() 方法中,声明一个字符串变量,并把该变量实例化为空的字符串。
``` vb
Dim myFileName As String = ""
```

``` csharp
string fileName = "";
```
  1. 在 ExportFormatType.CrystalReport 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .rpt 文件扩展名的可识别文档名。

    myFileName = exportPath & "Report.rpt"
    
    myFileName = exportPath + "Report.rpt";
    
  2. 在 ExportFormatType.RichText 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .rtf 文件扩展名的可识别文档名。

    myFileName = exportPath & "RichTextFormat.rtf"
    
    myFileName = exportPath + "RichTextFormat.rtf";
    
  3. 在 ExportFormatType.WordForWindows 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .doc 文件扩展名的可识别文档名。

    myFileName = exportPath & "Word.doc"
    
    fileName = exportPath + "Word.doc";
    
  4. 在 ExportFormatType.Excel 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .xls 文件扩展名的可识别文档名。

    myFileName = exportPath & "Excel.xls"
    
    fileName = exportPath + "Excel.xls";
    
  5. 在 ExportFormatType.PortableDocFormat 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .pdf 文件扩展名的可识别文档名。

    myFileName = exportPath & "PortableDoc.pdf"
    
    fileName = exportPath + "PortableDoc.pdf";
    
  6. 在 ExportFormatType.HTML32 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .html 文件扩展名的可识别文档名。

    myFileName = exportPath & "HTML32.html"
    
    fileName = exportPath + "HTML32.html";
    
  7. 在 ExportFormatType.HTML40 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .html 文件扩展名的可识别文档名。

    myFileName = exportPath & "HTML40.html"
    
    fileName = exportPath + "HTML40.html";
    
  8. 在 ExportFormatType.ExcelRecord 条件分支语句中,把文件名字符串设置为 exportPath 字符串,后跟带有 .xls 文件扩展名的可识别文档名。

    myFileName = exportPath & "ExcelRecord.xls"
    
    fileName = exportPath + "ExcelRecord.xls";