KMConvertExcelWindowController.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // KMConvertExcelWindowController.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2022/12/6.
  6. //
  7. import Cocoa
  8. // 转档 Excel 窗口
  9. class KMConvertExcelWindowController: KMConvertBaseWindowController {
  10. override var fileExtension: String {
  11. return KMPDFConvert.pathExtension(.excel)
  12. }
  13. override func initDefaultValue() {
  14. super.initDefaultValue()
  15. self.titleLabel.stringValue = NSLocalizedString("PDF to Excel", comment: "")
  16. }
  17. override func initSettingView() -> KMConvertSettingView? {
  18. return KMConvertExcelSettingView.createFromNib()
  19. }
  20. override func initConvert() -> KMPDFConvert {
  21. return KMPDFConvertExcel()
  22. }
  23. override func convertModelAppendParams(convert: KMPDFConvert) {
  24. super.convertModelAppendParams(convert: convert)
  25. let settingView: KMConvertExcelSettingView = self.settingView as! KMConvertExcelSettingView
  26. if settingView.selectedSettingIndex == 0 {
  27. convert.isExtractTable = false
  28. convert.isExtractText = false
  29. if (settingView.selectedSheetIndex == 0) {
  30. convert.isAllInOneSheet = false
  31. } else if (settingView.selectedSheetIndex == 1) {
  32. convert.isAllInOneSheet = true
  33. }
  34. } else if settingView.selectedSettingIndex == 1 {
  35. convert.isAllInOneSheet = false
  36. convert.isExtractText = false
  37. convert.isExtractTable = true
  38. convert.extractTableIndex = settingView.selectedTableFormatIndex
  39. } else if (settingView.selectedSettingIndex == 2) {
  40. convert.isAllInOneSheet = false
  41. convert.isExtractTable = false
  42. convert.isExtractText = true
  43. }
  44. }
  45. }