fpspreadsheet: Fix duplicate unit message. Remove some hints and warnings.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6557 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
3c28657703
commit
f3b9d0f2a0
@ -8324,7 +8324,6 @@ const
|
|||||||
var
|
var
|
||||||
buf: packed array[0..7] of byte = (0,0,0,0,0,0,0,0);
|
buf: packed array[0..7] of byte = (0,0,0,0,0,0,0,0);
|
||||||
i: Integer;
|
i: Integer;
|
||||||
ok: Boolean;
|
|
||||||
begin
|
begin
|
||||||
SetLength(AFormatIDs, 0);
|
SetLength(AFormatIDs, 0);
|
||||||
|
|
||||||
@ -8345,7 +8344,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Check for Excel 2
|
// Check for Excel 2
|
||||||
ok := true;
|
|
||||||
for i:=0 to High(BIFF2_HEADER) do
|
for i:=0 to High(BIFF2_HEADER) do
|
||||||
if buf[i] = BIFF2_HEADER[i] then
|
if buf[i] = BIFF2_HEADER[i] then
|
||||||
begin
|
begin
|
||||||
@ -8480,41 +8478,18 @@ end;
|
|||||||
procedure TsWorkbook.ReadFromFile(AFileName: string; APassword: String = '';
|
procedure TsWorkbook.ReadFromFile(AFileName: string; APassword: String = '';
|
||||||
AParams: TsStreamParams = []);
|
AParams: TsStreamParams = []);
|
||||||
var
|
var
|
||||||
formatIDs: TsSpreadFormatIDArray;
|
|
||||||
success: Boolean;
|
success: Boolean;
|
||||||
fileFormats: TsSpreadFormatIDArray;
|
fileFormats: TsSpreadFormatIDArray;
|
||||||
ext: String;
|
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if not FileExists(AFileName) then
|
if not FileExists(AFileName) then
|
||||||
raise EFPSpreadsheetReader.CreateFmt(rsFileNotFound, [AFileName]);
|
raise EFPSpreadsheetReader.CreateFmt(rsFileNotFound, [AFileName]);
|
||||||
|
|
||||||
ext := LowerCase(ExtractFileExt(AFileName));
|
|
||||||
|
|
||||||
// Try to get file format from file header
|
// Try to get file format from file header
|
||||||
GetFormatFromFileHeader(AFileName, fileformats);
|
GetFormatFromFileHeader(AFileName, fileformats);
|
||||||
if Length(fileformats) = 0 then
|
if Length(fileformats) = 0 then
|
||||||
// If not successful use formats defined by extension
|
// If not successful use formats defined by extension
|
||||||
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName);
|
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName);
|
||||||
(*
|
|
||||||
// Collect all formats which have the same extension
|
|
||||||
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName);
|
|
||||||
if (Length(fileFormats) > 1) {and (ext = STR_EXCEL_EXTENSION)} then
|
|
||||||
begin
|
|
||||||
// In case of xls files we try to determine the format from the header
|
|
||||||
canLoad := GetFormatFromFileHeader(AFilename, formatIDs);
|
|
||||||
if canLoad then begin
|
|
||||||
// Analysis of the file header was successful --> we know the file
|
|
||||||
// format and shorten the list of fileformats to just one item.
|
|
||||||
SetLength(fileFormats, 1);
|
|
||||||
fileformats[0] := formatID;
|
|
||||||
end else
|
|
||||||
// If analysis of the header fails we open the file explicitly by
|
|
||||||
// trial and error for each format -- see below.
|
|
||||||
// We begin with BIFF8 which is the most common xls format now.
|
|
||||||
// The next command re-reads the format list with BIFF8 at the first place.
|
|
||||||
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName, ord(sfExcel8));
|
|
||||||
end; *)
|
|
||||||
|
|
||||||
// No file format found for this file --> error
|
// No file format found for this file --> error
|
||||||
if Length(fileformats) = 0 then
|
if Length(fileformats) = 0 then
|
||||||
@ -8759,8 +8734,6 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
function TsWorkbook.AddWorksheet(AName: string;
|
function TsWorkbook.AddWorksheet(AName: string;
|
||||||
ReplaceDuplicateName: Boolean = false): TsWorksheet;
|
ReplaceDuplicateName: Boolean = false): TsWorksheet;
|
||||||
var
|
|
||||||
msg: String;
|
|
||||||
begin
|
begin
|
||||||
// Check worksheet name
|
// Check worksheet name
|
||||||
if not ReplaceDuplicateName and (GetWorksheetByName(AName) <> nil) then
|
if not ReplaceDuplicateName and (GetWorksheetByName(AName) <> nil) then
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
Registration for fpsexport into the Lazarus component palette
|
|
||||||
This requires package lazdbexport for property editors etc
|
|
||||||
}
|
|
||||||
unit fpsexportreg;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
{$R ../../resource/fpsvisualexportreg.res}
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
Classes, SysUtils, LazarusPackageIntf, lresources;
|
|
||||||
|
|
||||||
procedure Register;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
uses
|
|
||||||
fpsexport;
|
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
|
||||||
Registers the export component in the Lazarus component palette,
|
|
||||||
page "Data Export".
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
procedure Register;
|
|
||||||
begin
|
|
||||||
RegisterComponents('Data Export', [TFPSExport]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user