KMConvertExcelWindowController.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 initContentView() {
  14. super.initContentView()
  15. self.titleLabel.stringValue = NSLocalizedString("PDF to Excel", comment: "")
  16. self.setupContentHeight(height: 391+20)
  17. }
  18. override func initSettingView() -> KMConvertSettingView? {
  19. return KMConvertExcelSettingView.createFromNib()
  20. }
  21. override func initConvert() -> KMPDFConvert {
  22. return KMPDFConvertExcel()
  23. }
  24. override func convertModelAppendParams(convert: KMPDFConvert) {
  25. super.convertModelAppendParams(convert: convert)
  26. let settingView: KMConvertExcelSettingView = self.settingView as! KMConvertExcelSettingView
  27. if settingView.selectedSettingIndex == 0 {
  28. convert.isExtractTable = false
  29. convert.isExtractText = false
  30. if (settingView.selectedSheetIndex == 0) {
  31. convert.isAllInOneSheet = false
  32. } else if (settingView.selectedSheetIndex == 1) {
  33. convert.isAllInOneSheet = true
  34. }
  35. } else if settingView.selectedSettingIndex == 1 {
  36. convert.isAllInOneSheet = false
  37. convert.isExtractText = false
  38. convert.isExtractTable = true
  39. convert.extractTableIndex = settingView.selectedTableFormatIndex
  40. } else if (settingView.selectedSettingIndex == 2) {
  41. convert.isAllInOneSheet = false
  42. convert.isExtractTable = false
  43. convert.isExtractText = true
  44. }
  45. }
  46. }