spready: Integrate biff4 reader.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8770 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-03-22 23:10:00 +00:00
parent 15876adb93
commit 8d89413110
2 changed files with 36 additions and 23 deletions

View File

@ -5,7 +5,7 @@ object MainForm: TMainForm
Width = 1120 Width = 1120
AllowDropFiles = True AllowDropFiles = True
Caption = 'spready' Caption = 'spready'
ClientHeight = 689 ClientHeight = 709
ClientWidth = 1120 ClientWidth = 1120
Menu = MainMenu Menu = MainMenu
OnCloseQuery = FormCloseQuery OnCloseQuery = FormCloseQuery
@ -13,10 +13,10 @@ object MainForm: TMainForm
OnDropFiles = FormDropFiles OnDropFiles = FormDropFiles
OnShow = FormShow OnShow = FormShow
ShowHint = True ShowHint = True
LCLVersion = '2.1.0.0' LCLVersion = '2.3.0.0'
object WorkbookTabControl: TsWorkbookTabControl object WorkbookTabControl: TsWorkbookTabControl
Left = 0 Left = 0
Height = 609 Height = 629
Top = 80 Top = 80
Width = 792 Width = 792
TabIndex = 0 TabIndex = 0
@ -28,7 +28,7 @@ object MainForm: TMainForm
WorkbookSource = WorkbookSource WorkbookSource = WorkbookSource
object WorksheetGrid: TsWorksheetGrid object WorksheetGrid: TsWorksheetGrid
Left = 2 Left = 2
Height = 584 Height = 604
Top = 23 Top = 23
Width = 788 Width = 788
AutoCalc = True AutoCalc = True
@ -58,7 +58,7 @@ object MainForm: TMainForm
end end
object InspectorTabControl: TTabControl object InspectorTabControl: TTabControl
Left = 797 Left = 797
Height = 609 Height = 629
Top = 80 Top = 80
Width = 323 Width = 323
MultiLine = True MultiLine = True
@ -77,7 +77,7 @@ object MainForm: TMainForm
Visible = False Visible = False
object Inspector: TsSpreadsheetInspector object Inspector: TsSpreadsheetInspector
Left = 2 Left = 2
Height = 564 Height = 584
Top = 43 Top = 43
Width = 319 Width = 319
Align = alClient Align = alClient
@ -145,7 +145,7 @@ object MainForm: TMainForm
end end
object InspectorSplitter: TSplitter object InspectorSplitter: TSplitter
Left = 792 Left = 792
Height = 609 Height = 629
Top = 80 Top = 80
Width = 5 Width = 5
Align = alRight Align = alRight
@ -348,7 +348,7 @@ object MainForm: TMainForm
Width = 130 Width = 130
WorkbookSource = WorkbookSource WorkbookSource = WorkbookSource
DropDownCount = 24 DropDownCount = 24
ItemIndex = 37 ItemIndex = 40
TabOrder = 0 TabOrder = 0
Text = 'Arial' Text = 'Arial'
end end

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, mrumanager, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, mrumanager, Forms, Controls, Graphics, Dialogs,
ExtCtrls, ComCtrls, ActnList, Menus, StdActns, Buttons, Grids, StdCtrls, ExtCtrls, ComCtrls, ActnList, Menus, StdActns, Buttons, Grids, StdCtrls,
types, fpstypes, fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, types, fpstypes, fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid,
fpsActions, fpsAllFormats, fpsSYLK, xlsxml, xlsxooxml_crypto; fpsActions, fpsAllFormats, fpsSYLK, xlsBIFF4, xlsxml, xlsxooxml_crypto;
// NOTE: // NOTE:
// In order to use the decrypting xlsx reader put xlsxooxlm_cryto after // In order to use the decrypting xlsx reader put xlsxooxlm_cryto after
// xlsxooxml or fpsAllforamts. // xlsxooxml or fpsAllforamts.
@ -1295,7 +1295,8 @@ end;
procedure TMainForm.FormCreate(Sender: TObject); procedure TMainForm.FormCreate(Sender: TObject);
var var
priorityFormats: Array[0..8] of TsSpreadFormatID; priorityFormatsR: Array[0..9] of TsSpreadFormatID;
priorityFormatsW: Array[0..8] of TsSpreadFormatID;
i: Integer; i: Integer;
begin begin
FMRUMenuManager := TMRUMenuManager.Create(self); FMRUMenuManager := TMRUMenuManager.Create(self);
@ -1310,24 +1311,36 @@ begin
OnRecentFile := @MRUMenuManagerRecentFile; OnRecentFile := @MRUMenuManagerRecentFile;
end; end;
priorityFormats[0] := ord(sfOOXML); priorityFormatsR[0] := ord(sfOOXML);
priorityFormats[1] := ord(sfExcel8); priorityFormatsR[1] := ord(sfExcel8);
priorityFormats[2] := ord(sfExcel5); priorityFormatsR[2] := ord(sfExcel5);
priorityFormats[3] := ord(sfExcel2); priorityFormatsR[3] := sfidExcel4;
priorityFormats[4] := ord(sfExcelXML); priorityFormatsR[4] := ord(sfExcel2);
priorityFormats[5] := ord(sfOpenDocument); priorityFormatsR[5] := ord(sfExcelXML);
priorityFormats[6] := ord(sfCSV); priorityFormatsR[6] := ord(sfOpenDocument);
priorityFormats[7] := sfidSYLK; priorityFormatsR[7] := ord(sfCSV);
priorityFormats[8] := ord(sfHTML); priorityFormatsR[8] := sfidSYLK;
priorityFormatsR[9] := ord(sfHTML);
AcFileOpen.Dialog.Filter := GetFileFormatFilter('|', ';', faRead, priorityFormats, true, true); priorityFormatsW[0] := ord(sfOOXML);
FOpenFormats := GetSpreadFormats(faRead, priorityFormats); priorityFormatsW[1] := ord(sfExcel8);
priorityFormatsW[2] := ord(sfExcel5);
//priorityFormatsW[3] := sfidExcel4; // no write support here
priorityFormatsW[3] := ord(sfExcel2);
priorityFormatsW[4] := ord(sfExcelXML);
priorityFormatsW[5] := ord(sfOpenDocument);
priorityFormatsW[6] := ord(sfCSV);
priorityFormatsW[7] := sfidSYLK;
priorityFormatsW[8] := ord(sfHTML);
AcFileOpen.Dialog.Filter := GetFileFormatFilter('|', ';', faRead, priorityFormatsR, true, true);
FOpenFormats := GetSpreadFormats(faRead, priorityFormatsR);
// Use decrypting XLSX format instead of normal XLSX format // Use decrypting XLSX format instead of normal XLSX format
for i:=0 to High(FOpenFormats) do for i:=0 to High(FOpenFormats) do
if FOpenFormats[i] = ord(sfOOXML) then FOpenFormats[i] := sfidOOXML_Crypto; if FOpenFormats[i] = ord(sfOOXML) then FOpenFormats[i] := sfidOOXML_Crypto;
AcFileSaveAs.Dialog.Filter := GetFileFormatFilter('|', ';', faWrite, priorityFormats); AcFileSaveAs.Dialog.Filter := GetFileFormatFilter('|', ';', faWrite, priorityFormatsW);
FSaveFormats := GetSpreadFormats(faWrite, priorityFormats); FSaveFormats := GetSpreadFormats(faWrite, priorityFormatsW);
Panel2.Height := CellIndicator.Height + 2; Panel2.Height := CellIndicator.Height + 2;
Panel3.Constraints.MinHeight := CellIndicator.Height + 2; Panel3.Constraints.MinHeight := CellIndicator.Height + 2;