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

View File

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