KMConvertExcelWindowController.swift 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // KMConvertExcelWindowController.swift
  3. // PDF Reader Pro
  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 initSubViews() {
  18. super.initSubViews()
  19. self.setupContentHeight(height: 391+20)
  20. }
  21. override func initSettingView() -> KMConvertSettingView? {
  22. return KMConvertExcelSettingView.createFromNib()
  23. }
  24. override func initConvert() -> KMPDFConvert {
  25. return KMPDFConvertExcel()
  26. }
  27. override func convertModelAppendParams(convert: KMPDFConvert) {
  28. super.convertModelAppendParams(convert: convert)
  29. let settingView: KMConvertExcelSettingView = self.settingView as! KMConvertExcelSettingView
  30. if settingView.selectedSettingIndex == 0 {
  31. convert.isExtractTable = false
  32. convert.isExtractText = false
  33. if (settingView.selectedSheetIndex == 0) {
  34. convert.isAllInOneSheet = false
  35. } else if (settingView.selectedSheetIndex == 1) {
  36. convert.isAllInOneSheet = true
  37. }
  38. } else if settingView.selectedSettingIndex == 1 {
  39. convert.isAllInOneSheet = false
  40. convert.isExtractText = false
  41. convert.isExtractTable = true
  42. convert.extractTableIndex = settingView.selectedTableFormatIndex
  43. } else if (settingView.selectedSettingIndex == 2) {
  44. convert.isAllInOneSheet = false
  45. convert.isExtractTable = false
  46. convert.isExtractText = true
  47. }
  48. }
  49. }