fpspreadsheet: Add BiffExplorer, a testing and debugging tool for xls files, to folder "reference"

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2938 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-04-13 10:58:41 +00:00
parent 4f0c0e5bc4
commit 32f6b81a6d
14 changed files with 7876 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="BIFFExplorer"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="3">
<Item1 Name="Release" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="mrumenu"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CustomOptions Value="-duse_new_ole"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
<Item3 Name="Debug with heaptrace">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="mrumenu"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CustomOptions Value="-duse_new_ole"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item3>
<SharedMatrixOptions Count="1">
<Item1 ID="897672969650" Value="-vd"/>
</SharedMatrixOptions>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="4">
<Item1>
<PackageName Value="laz_fpspreadsheet"/>
</Item1>
<Item2>
<PackageName Value="TurboPowerIPro"/>
</Item2>
<Item3>
<PackageName Value="virtualtreeview_package"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="10">
<Unit0>
<Filename Value="BIFFExplorer.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BIFFExplorer"/>
</Unit0>
<Unit1>
<Filename Value="beabout.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="AboutForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="beAbout"/>
</Unit1>
<Unit2>
<Filename Value="bebiffgrid.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beBIFFGrid"/>
</Unit2>
<Unit3>
<Filename Value="bebiffutils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="bebiffutils"/>
</Unit3>
<Unit4>
<Filename Value="behtml.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="behtml"/>
</Unit4>
<Unit5>
<Filename Value="bemain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="beMain"/>
</Unit5>
<Unit6>
<Filename Value="beutils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beUtils"/>
</Unit6>
<Unit7>
<Filename Value="mrumanager.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="mrumanager"/>
</Unit7>
<Unit8>
<Filename Value="bemain.lfm"/>
<IsPartOfProject Value="True"/>
</Unit8>
<Unit9>
<Filename Value="beabout.lfm"/>
<IsPartOfProject Value="True"/>
</Unit9>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="mrumenu"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CustomOptions Value="-duse_new_ole"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,22 @@
program BIFFExplorer;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, virtualtreeview_package, laz_fpspreadsheet, beabout, bebiffgrid,
bebiffutils, behtml, beutils, mrumanager, beMain;
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
MainForm.BeforeRun;
Application.Run;
end.

View File

@ -0,0 +1,85 @@
object AboutForm: TAboutForm
Left = 338
Height = 512
Top = 153
Width = 642
Caption = 'About BIFF Explorer'
ClientHeight = 512
ClientWidth = 642
Color = clWindow
OnCreate = FormCreate
Position = poMainFormCenter
LCLVersion = '1.3'
object Panel1: TPanel
Left = 0
Height = 66
Top = 0
Width = 642
Align = alTop
BevelOuter = bvNone
ClientHeight = 66
ClientWidth = 642
Color = clWindow
ParentColor = False
TabOrder = 0
object IconImage: TImage
Left = 7
Height = 48
Top = 8
Width = 48
end
object LblTitle: TLabel
Left = 69
Height = 29
Top = 16
Width = 158
Caption = 'BIFF Explorer'
Font.CharSet = ANSI_CHARSET
Font.Color = clNavy
Font.Height = -24
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object BtnClose: TButton
Left = 559
Height = 29
Top = 16
Width = 75
Anchors = [akTop, akRight]
Cancel = True
Caption = 'Close'
Default = True
ModalResult = 1
TabOrder = 0
end
end
object Bevel1: TBevel
Left = 0
Height = 6
Top = 66
Width = 642
Align = alTop
Shape = bsTopLine
end
object HTMLViewer: TIpHtmlPanel
Left = 0
Height = 440
Top = 72
Width = 642
Align = alClient
FixedTypeface = 'Courier New'
DefaultTypeFace = 'default'
DefaultFontSize = 9
FlagErrors = False
PrintSettings.MarginLeft = 0.5
PrintSettings.MarginTop = 0.5
PrintSettings.MarginRight = 0.5
PrintSettings.MarginBottom = 0.5
TabOrder = 1
OnHotClick = HTMLViewerHotClick
end
end

View File

@ -0,0 +1,141 @@
unit beAbout;
{$mode objfpc}{$H+}
interface
uses
Classes, IpHtml, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ TAboutForm }
TAboutForm = class(TForm)
Bevel1: TBevel;
BtnClose: TButton;
IconImage: TImage;
HTMLViewer: TIpHtmlPanel;
LblTitle: TLabel;
Panel1: TPanel;
procedure FormCreate(Sender: TObject);
procedure HTMLViewerHotClick(Sender: TObject);
private
{ private declarations }
function CreateCredits: String;
public
{ public declarations }
end;
var
AboutForm: TAboutForm;
implementation
{$R *.lfm}
uses
LCLIntf, types, beHTML;
{ TAboutForm }
function TAboutForm.CreateCredits: String;
var
html: THTMLDocument;
clrs: THeaderColors = (clBlack, clBlack, clBlack, clBlack, clBlack);
begin
html := THTMLDocument.Create;
try
clrs[h3] := LblTitle.Font.Color;
clrs[h4] := LblTitle.Font.Color;
with html do begin
BeginDocument('Credits', clrs, false);
AddHeader(h3, 'Credits');
AddHeader(h4, 'Libraries');
BeginBulletList;
AddListItem(Hyperlink(
'Free Pascal',
'www.freepascal.org')
);
AddListItem(Hyperlink(
'Lazarus',
'www.lazarus.freepascal.org')
);
AddListItem(HyperLink(
'fpspreadsheet',
'http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/fpspreadsheet/')
);
EndBulletList;
AddEmptyLine;
AddHeader(h4, 'Icons');
BeginBulletList;
AddListItem(HyperLink(
'Fugue icons',
'http://p.yusukekamiyamane.com/')
+ ' (for toolbar icons)');
AddListItem(HyperLink(
'Nuvola icons',
'www.icon-king.com/projects/nuvola/') +
' (for application icon');
EndBulletList;
AddEmptyLine;
AddHeader(h4, 'Used documentation');
BeginBulletList;
AddListItem(Hyperlink(
'OpenOffice.org''s Documentation of the Microsoft Excel File Format',
'http://www.openoffice.org/sc/excelfileformat.pdf') +
' (see folder "fpspreadsheet/reference")'
);
AddListItem(Hyperlink(
'[MS-XLS]: Excel Binary File Format (.xls) Structure',
'http://msdn.microsoft.com/en-us/library/cc313154%28v=office.12%29.aspx'
));
AddListItem(HyperLink(
'Excel97-2007BinaryFileFormat(xls)Specification',
'http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Excel97-2007BinaryFileFormat(xls)Specification.pdf'
));
EndBulletList;
EndDocument;
Result := Lines.Text;
end;
finally
html.Free;
end;
end;
procedure TAboutForm.FormCreate(Sender: TObject);
var
ico: TIcon;
sz: TSize;
begin
ico := TIcon.Create;
try
ico.Assign(Application.Icon);
sz.cx := 48;
sz.cy := 48;
ico.Current := ico.GetBestIndexForSize(sz);
IconImage.Picture.Assign(ico);
finally
ico.Free;
end;
HTMLViewer.SetHTMLFromStr(CreateCredits);
end;
procedure TAboutForm.HTMLViewerHotClick(Sender: TObject);
begin
OpenURL(HTMLViewer.HotURL);
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,708 @@
unit beBIFFUtils;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
function BOFName(ACode: Word): String;
function CodePageName(AID: Word): String;
function RecTypeName(ARecType: Word): String;
function SheetFuncName(AIndex: Word): String;
function ErrorCodeName(ACode: Byte): String;
implementation
function BOFName(ACode: Word): String;
begin
case ACode of
$0005: Result := 'Workbook globals';
$0006: Result := 'Visual Basic module';
$0010: Result := 'Sheet or dialog';
$0020: Result := 'Chart';
$0040: Result := 'Macro sheet';
$0100: Result := 'Workspace';
else Result := '';
end;
end;
function CodePageName(AID: Word): String;
begin
case AID of
$0016: Result := 'ASCII';
$01B5: Result := 'IBM PC CP-437 (US)';
$02D0: Result := 'IBM PC CP-720 (OEM Arabic)';
$02E1: Result := 'IBM PC CP-737 (Greek)';
$0307: Result := 'IBM PC CP-775 (Baltic)';
$0352: Result := 'IBM PC CP-850 (Latin I)';
$0354: Result := 'IBM PC CP-852 (Latin II (Central European))';
$0357: Result := 'IBM PC CP-855 (Cyrillic)';
$0359: Result := 'IBM PC CP-857 (Turkish)';
$035A: Result := 'IBM PC CP-858 (Multilingual Latin I with Euro)';
$035C: Result := 'IBM PC CP-860 (Portuguese)';
$035D: Result := 'IBM PC CP-861 (Icelandic)';
$035E: Result := 'IBM PC CP-862 (Hebrew)';
$035F: Result := 'IBM PC CP-863 (Canadian (French))';
$0360: Result := 'IBM PC CP-864 (Arabic)';
$0361: Result := 'IBM PC CP-865 (Nordic)';
$0362: Result := 'IBM PC CP-866 (Cyrillic (Russian))';
$0365: Result := 'IBM PC CP-869 (Greek (Modern))';
$036A: Result := 'Windows CP-874 (Thai)';
$03A4: Result := 'Windows CP-932 (Japanese Shift-JIS)';
$03A8: Result := 'Windows CP-936 (Chinese Simplified GBK)';
$03B5: Result := 'Windows CP-949 (Korean (Wansung))';
$03B6: Result := 'Windows CP-950 (Chinese Traditional BIG5)';
$04B0: Result := 'UTF-16 (BIFF8)';
$04E2: Result := 'Windows CP-1250 (Latin II) (Central European)';
$04E3: Result := 'Windows CP-1251 (Cyrillic)';
$04E4: Result := 'Windows CP-1252 (Latin I) (BIFF4-BIFF5)';
$04E5: Result := 'Windows CP-1253 (Greek)';
$04E6: Result := 'Windows CP-1254 (Turkish)';
$04E7: Result := 'Windows CP-1255 (Hebrew)';
$04E8: Result := 'Windows CP-1256 (Arabic)';
$04E9: Result := 'Windows CP-1257 (Baltic)';
$04EA: Result := 'Windows CP-1258 (Vietnamese)';
$0551: Result := 'Windows CP-1361 (Korean (Johab))';
$2710: Result := 'Apple Roman';
$8000: Result := 'Apple Roman';
$8001: Result := 'Windows CP-1252 (Latin I) (BIFF2-BIFF3)';
else Result := '';
end;
end;
function ErrorCodeName(ACode: Byte): String;
begin
case ACode of
$00: Result := '#NULL! - Intersection of two cell ranges is empty';
$07: Result := '#DIV/0! - Division by zero';
$0F: Result := '#VALUE! - Wrong type of operand';
$17: Result := '#REF! - Illegal or deleted cell reference';
$1D: Result := '#NAME? - Wrong function or range name';
$24: Result := '#NUM! - Value range overflow';
$2A: Result := '#N/A - Argument or function not available';
else Result := '(unknown)';
end;
end;
function RecTypeName(ARecType: Word): String;
begin
case ARecType of
$0000: Result := 'Dimension';
$0001: Result := 'Blank';
$0002: Result := 'Integer';
$0003: Result := 'Number';
$0004: Result := 'Label';
$0005: Result := 'BoolErr';
$0006: Result := 'Formula';
$0007: Result := 'String';
$0008: Result := 'Row';
$0009: Result := 'BOF';
$000A: Result := 'EOF: End of file';
$000B: Result := 'Index';
$000C: Result := 'CALCCOUNT: Iteration count';
$000D: Result := 'CALCMODE: Calculation mode';
$000E: Result := 'PRECISION: Precision';
$000F: Result := 'REFMODE: Reference mode';
$0010: Result := 'DELTA: Iteration increment';
$0011: Result := 'ITERATION: Iteration mode';
$0012: Result := 'PROTECT: Protection flag';
$0013: Result := 'PASSWORD: Protection password';
$0014: Result := 'HEADER: Print header on each page';
$0015: Result := 'FOOTER: Print footer on each page';
$0016: Result := 'EXTERNCOUNT: Number of external references';
$0017: Result := 'EXTERNSHEET: External reference';
$0018: Result := 'DefinedName';
$0019: Result := 'WINDOWPROTECT: Windows are protected';
$001A: Result := 'VERTICALPAGEBREAKS: Explicit column page breaks';
$001B: Result := 'HORIZONALPAGEBREAKS: Explicit row page breaks';
$001C: Result := 'NOTE: Comment associated with a cell';
$001D: Result := 'SELECTION: current selection';
$001E: Result := 'Format';
$001F: Result := 'BuiltInFmtCount';
$0020: Result := 'ColumnDefault';
$0021: Result := 'Array';
$0022: Result := '1904: 1904 date system';
$0023: Result := 'ExternalName';
$0024: Result := 'ColWidth';
$0025: Result := 'DefaultRowHeight';
$0026: Result := 'LEFTMARGIN: Left margin measurement';
$0027: Result := 'RIGHTMARGIN: Right margin measurement';
$0028: Result := 'TOPMARGIN: Top margin measurement';
$0029: Result := 'BOTTOMMARGIN: Bottom margin measurement';
$002A: Result := 'PRINTHEADERS: Print row/column labels';
$002B: Result := 'PRINTGRIDLINES: Print gridlines flag';
$002F: Result := 'FILEPASS: File is password-protected';
$0031: Result := 'FONT: Font and font formatting information';
$0032: Result := 'Font2';
$0033: Result := 'PRINTSIZE: Printed size of chart';
$0036: Result := 'DataTable';
$0037: Result := 'DateTable2';
$003C: Result := 'CONTINUE: Continues long records';
$003D: Result := 'WINDOW1: Window information';
$003E: Result := 'Window2';
$0040: Result := 'BACKUP: Save backup version of the file';
$0041: Result := 'PANE: Number of panes and their position';
$0042: Result := 'CODEPAGE: Default code page'; // also: CODENAME: VBE object name ???
$0043: Result := 'XF: Extended f';
$0044: Result := 'IXFE';
$0045: Result := 'FontColor';
$004D: Result := 'PLS: Environment-specific print record';
$0050: Result := 'DCON: Data consolidation information';
$0051: Result := 'DCONREF: Data consolidation references';
$0055: Result := 'DEFCOLWIDTH: Default width for columns';
$0056: Result := 'BuiltInFmtCount';
$0059: Result := 'XCT: CRN record count';
$005A: Result := 'CRN: Non-resident operands';
$005B: Result := 'FILESHARING: File-sharing information';
$005C: Result := 'WRITEACCESS: Write access user name';
$005E: Result := 'UNCALCED: Recalculation status';
$005F: Result := 'SAVERECALC: Recalculate before saving';
$0060: Result := 'TEMPLATE: Workbook is a template';
$0063: Result := 'OBJPROTECT: Objects are protected';
$007D: Result := 'COLINFO: Column formatting information';
$007E: Result := 'RK: Cell value, RK number';
$007F: Result := 'IMDATA: Image data';
$0080: Result := 'GUTS: Size of row and column gutters';
$0081: Result := 'SHEETPR: Additional workspace information';
$0082: Result := 'GRIDSET: State change of Gridlines option';
$0083: Result := 'HCENTER: Center between horizontal margins';
$0084: Result := 'VCENTER: Center between vertical margins';
$0085: Result := 'BOUNDSSHEET: Sheet information';
$0086: Result := 'WRITEPROT: Workbook is write-protected';
$0087: Result := 'ADDIN: Workbook is an add-in macro';
$0088: Result := 'EDG: Edition globals';
$0089: Result := 'PUB: Publisher';
$008C: Result := 'COUNTRY: Default country and WIN.INI country';
$008D: Result := 'HIDEOBJ: Object display options';
$0090: Result := 'SORT: Sorting options';
$0091: Result := 'SUB: Subscriber';
$0092: Result := 'PALETTE: Color palette definition';
$0094: Result := 'LHRECORD: .WK? file conversion information';
$0095: Result := 'LHNGRAPH: Named graph information';
$0096: Result := 'SOUND: Sound note';
$0098: Result := 'LPR: Sheet was printed using LINE.PRINT()';
$0099: Result := 'STANDARDWIDTH: Standard column width';
$009A: Result := 'FNGROUPNAME: Function group name';
$009B: Result := 'FILTERMODE: Sheet contains filtered list';
$009C: Result := 'FNGROUPCOUNT: Built-in function group count';
$009D: Result := 'AUTOFILTERINFO: Drop-down arrow count';
$009E: Result := 'AUTOFILTER: AutoFilter data';
$00A0: Result := 'SCL: Window zoom magnification';
$00A1: Result := 'SETUP: PageSetup';
$00A9: Result := 'COORDLIST: Polygon object vertex coordinates';
$00AB: Result := 'GCW: Global column width flags';
$00AE: Result := 'SCENMAN: Scenario output data';
$00AF: Result := 'SCENARIO: Scenario data';
$00B0: Result := 'SXVIEW: View definition';
$00B1: Result := 'SXVD: View fields';
$00B2: Result := 'SXVI: View item';
$00B4: Result := 'SXIVD: Row/column field IDs';
$00B5: Result := 'SXLI: Line item array';
$00B6: Result := 'SXPI: Page item';
$00B8: Result := 'DOCROUTE: Routing slip information';
$00B9: Result := 'RECIPNAME: Recipient name';
$00BC: Result := 'SHRFMLA: Shared formula';
$00BD: Result := 'MULRK: Multiple RK cells';
$00BE: Result := 'MULBLANK: Multiple blank cells';
$00C1: Result := 'MMS: ADDMENU/DELMENU record group count';
$00C2: Result := 'ADDMENU: Menu addition';
$00C3: Result := 'DELMENU: Menu deletion';
$00C5: Result := 'SXDI: Data item';
$00C6: Result := 'SXDB: Pivot table cache data';
$00CD: Result := 'SXSTRING: String';
$00D0: Result := 'SXTBL: Multiple consolidation source info';
$00D1: Result := 'SXBRGIITM: Page item name count';
$00D2: Result := 'SXTBPG: Page item indexex';
$00D3: Result := 'OBPROJ: Visual Basic project';
$00D5: Result := 'SXIDSTM: Stream ID';
$00D6: Result := 'RSTRING: Cell with character formatting';
$00D7: Result := 'DBCELL: Stream offsets';
$00DA: Result := 'BOOKBOOL: Workbook option flag';
$00DC: Result := 'PARAMQRY: Query parameters'; // also: SXEXT: External source information
$00DD: Result := 'SCENPROTECT: Scenario Protection';
$00DE: Result := 'OLESIZE: Size of OLE object';
$00DF: Result := 'UDDESC: Description format for chart autoformat';
$00E0: Result := 'XF: Extended format';
$00E1: Result := 'INTERFACEHDR: Beginning of user interface records';
$00E2: Result := 'INTERFACEEND: End of user interface records';
$00E3: Result := 'SXVS: View source';
$00E5: Result := 'MEGECELLS: Merged cells';
$00E9: Result := 'Bitmap';
$00EA: Result := 'TABIDCONF: Sheet Tab ID of conflict history';
$00EB: Result := 'MSODRAWINGGROUP: Microsoft Office drawing group';
$00EC: Result := 'MSODRAWING: Microsoft Office drawing';
$00ED: Result := 'MSODRAWINGSELECTION: Microsoft Office drawing selection';
$00EF: Result := 'PhoneticPR';
$00F0: Result := 'SXRULE: PivotTable rule data';
$00F1: Result := 'SXEX: PivotTable view extended information';
$00F2: Result := 'SXFILT: PivotTable rule filter';
$00F4: Result := 'SXDXF: PivotTable formatting';
$00F5: Result := 'SXITM: PivotTable item indexes';
$00F6: Result := 'SXNAME: PivotTable name';
$00F7: Result := 'SXSELECT: PivotTable selection information';
$00F8: Result := 'SXPAIR: PivotTable name pair';
$00F9: Result := 'SXFMLA: PivotTable parsed expression';
$00FB: Result := 'SXFORMAT: PivotTable format record';
$00FC: Result := 'SST: Shared string table';
$00FD: Result := 'LABELSST: Cell value, string constant/SST';
$00FF: Result := 'EXTSST: extended shared string table';
$013D: Result := 'TABID: Sheet tab index array';
$015F: Result := 'LabelRanges';
$0160: Result := 'USESELFS: Natural language formulas flag';
$0161: Result := 'DSF: Double stream file';
$0162: Result := 'XL5MODIFY: Flag for DSF';
$01AE: Result := 'SUPBOOK: Supporting workbook';
$01AF: Result := 'PROT4REV: Shared workbook protection flag';
$01B0: Result := 'CONDFMT: Conditional formatting range information';
$01B1: Result := 'CF: Conditional formatting conditions';
$01B2: Result := 'DVAL: Data validation information';
$01B5: Result := 'DCONBIN: Data consolidation information';
$01B6: Result := 'TXO: Text object';
$01B7: Result := 'REFRESHALL: Refresh flag';
$01B8: Result := 'HLINK: Hyperlink';
$01BA: Result := 'CODENAME: Name of the workbook object';
$01BB: Result := 'SXFDBTYPE: SQL datatype identifier';
$01BC: Result := 'PROT4REVPASS: Shared workbook protection password';
$01BE: Result := 'DV: Data validation criteria';
$01C0: Result := 'EXCEL9FILE: Excel 9 file';
$01C1: Result := 'RECALCID: Recalc information';
$0200: Result := 'DIMENSIONS: Cell table size';
$0201: Result := 'BLANK: Cell Value, blank cell';
$0203: Result := 'NUMBER: Cell value, floating-point cell';
$0204: Result := 'LABEL: Cell value, string constant';
$0205: Result := 'BOOLERR: Cell Value, boolean or error';
$0206: Result := 'Formula';
$0207: Result := 'STRING: String value of a formula';
$0208: Result := 'ROW: Describes a row';
$0209: Result := 'BOF';
$020B: Result := 'INDEX: Index record';
$0218: Result := 'NAME: Defined name';
$0221: Result := 'ARRAY: Array-entered formula';
$0223: Result := 'EXTERNNAME: Externally referenced name';
$0225: Result := 'DEFAULTROWHEIGHT: Default row height';
$0231: Result := 'FONT: Font description';
$0236: Result := 'TABLE: Data table';
$023E: Result := 'WINDOW2: Sheet window information';
$0243: Result := 'XF';
$027E: Result := 'RK';
$0293: Result := 'STYLE: Style information';
$0406: Result := 'FORMULA: Cell formula';
$0409: Result := 'BOF';
$041E: Result := 'FORMAT: Number format';
$0443: Result := 'XF';
$04BC: Result := 'SharedFormula';
$0800: Result := 'HLINKTOOLTOP: Hyperlink tooltip';
$0801: Result := 'WEBPUB: Web publish item';
$0802: Result := 'QSISXTAG: PivotTable and query table extensions';
$0803: Result := 'DBQUERYEXT: Database query extensions';
$0804: Result := 'EXTSTRING: FRT string';
$0805: Result := 'TXTQUERY: Text query information';
$0806: Result := 'QSIR: Query table formatting';
$0807: Result := 'QSIF: Query table field formatting';
$0809: Result := 'BOF: Beginning of file';
$080A: Result := 'OLEDBCONN: OLE database connection';
$080B: Result := 'WOPT: Web options';
$080C: Result := 'SXVIEWEX: Pivot table OLAP extensions';
$080D: Result := 'SXTH: Pivot table OLAP hierarchy';
$080E: Result := 'SXPIEX: OLAP page item extensions';
$080F: Result := 'SXVDTEX: View dimension OLAP extensions';
$0810: Result := 'SXVIEWX9: Pivot table extensions';
$0812: Result := 'CONTINUEFRT: Continued FRT';
$0813: Result := 'REALTIMEDATA: Real-time data (RTD)';
$0850: Result := 'CHARTFRTINFO: Future record identifiers';
$0852: Result := 'STARTBLOCK: Beginning of a collection of records';
$0853: Result := 'ENDBLOCK: End of a collection of records';
$0862: Result := 'SHEETEXT: Extra sheet info';
$0863: Result := 'BOOKEXT: Extra book info';
$0864: Result := 'SXADDL: Pivot table additional info';
$0865: Result := 'CRASHRECERR: Crash recovery error';
$0866: Result := 'HFPICTURE: Header/footer picture';
$0867: Result := 'FEATHEADR: Shared feature header';
$0868: Result := 'FEAT: Shared feature record';
$086A: Result := 'DATALABEXT: Chart data label extension';
$086B: Result := 'DATALABEXTCONTENTS: Chart data label extension contents';
$086C: Result := 'CELLWATCH: Cell watch';
$086D: Result := 'FEATINFO: Shared feature info record';
$0871: Result := 'FEATHEADR11: Shared feature header 11';
$0872: Result := 'FEAT11: Shared feature 11 record';
$0873: Result := 'FEATINFO11: Shared feature info 11 record';
$0874: Result := 'DROPDOWNOBJIDS: Drop down opbject';
$0875: Result := 'CONTINUEFRT11: Continue FRT 11';
$0876: Result := 'DCONN: Data connection';
$0877: Result := 'LIST12: Extra table data introduced in Excel 2007';
$0878: Result := 'FEAT12: Shared feature 12 record';
$0879: Result := 'CONDFMT12: Conditional formatting range information 12';
$087A: Result := 'CF12: Conditional formatting condition 12';
$087B: Result := 'CFEX: Conditional formatting extension';
$087C: Result := 'XFCRC: XF extension checksum';
$087D: Result := 'XFEXT: XF extension';
$087E: Result := 'EZFILTER12: Autofilter data introduced in Excel 2007';
$087F: Result := 'CONTINUEFRT12: Continue FRT 12';
$0881: Result := 'SXADDL12: Additional workbook connections information';
$0884: Result := 'MDTINFO: Information about a metadata type';
$0885: Result := 'MDXSTR: MDX metadata string';
$0886: Result := 'MDXTUPLE: Tuple MDX metadata';
$0887: Result := 'MDXSET: Set MDX metadata';
$0888: Result := 'MDXPROP: Member property MDX metadata';
$0889: Result := 'MDXKPI: Key performance indicator MDX metadata';
$088A: Result := 'MDTB: Block of metadata records';
$088B: Result := 'PLV: Page layout view settings in Excel 2007';
$088C: Result := 'COMPAR12: Compatibility checker 12';
$088D: Result := 'DXF: Differential XF';
$088E: Result := 'TABLESTYLES: Table styles';
$088F: Result := 'TABLESTYLE: Table style';
$0890: Result := 'TABLESTYLEELEMENT: Table style element';
$0892: Result := 'STYLEEXT: Named cell style extension';
$0893: Result := 'NAMEPUBLISH: Publish to Excel server data for name';
$0894: Result := 'NAMECMT: Name comment';
$0895: Result := 'SORTDATA12: Sort data 12';
$0896: Result := 'THEME: Theme';
$0897: Result := 'GUIDTYPELIB: VB project typelib GUID';
$0898: Result := 'FNGRP12: Function group';
$0899: Result := 'NAMEFNGRP12: Extra function group';
$089A: Result := 'MTRSETTINGS: Multi-threaded calculation settings';
$089B: Result := 'COMPRESSPICTURES: Automatic picture compression mode';
$089C: Result := 'HEADERFOOTER: Header footer';
$089E: Result := 'CRTMLFRT: Additional properties for chart elements';
$08A3: Result := 'FORCEFULLCALCULATION: Force full calculation settings';
$08A4: Result := 'SHAPEPROPSSTREAM: Shape formatting properties for chart elements';
$08A5: Result := 'TEXTPROPSSTREAM: Additional text properties for text in entire chart';
$08A7: Result := 'CRTLAYOUT12A: Layout information for a plot area';
$08C1: Result := 'LISTOBJ: List object';
$08C2: Result := 'LISTFIELD: List field';
$08C3: Result := 'LISTDV: List data validation';
$08C4: Result := 'LISTCONDFMT: List conditional formatting';
$08C5: Result := 'LIST CF: List cell formatting';
$08C6: Result := 'FMQRY: Filemaker queries';
$08C7: Result := 'FMSQRY: Filemaker queries';
$08C8: Result := 'PLV: Page layout view in Mac Excel 11';
$08C9: Result := 'LNEXT: Extenstion information for borders in Mac Office 11';
$08CA: Result := 'MKREXT: Extension information for markers in Mac Office 11';
$08CB: Result := 'CRTCOOPT: Color options for chart series in Mac Office 11';
$1001: Result := 'UNITS: ignored';
$1002: Result := 'CHART: Position and size of chart area';
$1003: Result := 'SERIES: Properties of the data for a series, a trendline, or error bars';
$1004: Result := 'CHSOURCELINK: Source of data series';
$1006: Result := 'DATAFORMAT: Formatting properties for data point or series';
$1007: Result := 'CHLINEFORMAT: Formatting attributes of line or border';
$1009: Result := 'MARKERFORMAT: Color, size, and shape of data markers';
$100A: Result := 'AREAFORMAT: Patterns and colors in filled chart region';
$100B: Result := 'PIEFORMAT: Distance of a data point(s) from pie';
$100C: Result := 'ATTACHEDLABEL: Properties of series data label';
$100D: Result := 'CHSTRING: Category name of series, or text for text box in chart';
$1014: Result := 'CHARTFORMAT: Properties of a chart group';
$1015: Result := 'LEGEND: Properties of a legend';
$1016: Result := 'SERIESLIST: Specifies the series for the chart';
$1017: Result := 'BAR: identifies a bar/column chart group';
$1018: Result := 'LINE: identifies a line chart group';
$1019: Result := 'PIE: identifies a pie/doughnut chart group';
$101A: Result := 'AREA: identifies an area chart group';
$101B: Result := 'SCATTER: identifies scatter or bubble chart group';
$101D: Result := 'AXIS: Properties of an axis';
$101E: Result := 'TICK: Attributes of axis labels and ticks';
$101F: Result := 'VALUERANGE: Properties of value axis';
$1021: Result := 'CHAXISLINE: Part of the axis specified by the LINEFORMAT record';
$1022: Result := 'CRTLINK: not used';
$1024: Result := 'DEFAULTTEXT: Text elements formatted by TEXT record';
$1025: Result := 'TEXT: Properties of an attached label';
$1026: Result := 'FONTX: Font for a given text element';
$1027: Result := 'OBJECTLINK: specifies object on chart, or entire chart, to which TEXT record is linked.';
$1032: Result := 'CHFRAME: Border and area formatting of chart';
$1033: Result := 'CHBEGIN: Indicates begin of a chart record block';
$1034: Result := 'CHEND: Indicates end of a chart record block';
$1035: Result := 'PLOTAREA: empty --> see FRAME record specifying plot area properties';
$103A: Result := 'CHART3D: plot area of the chart group is rendered in a 3-D';
$103C: Result := 'PICF: Layout of a picture attached to a picture-filled chart elemen';
$103D: Result := 'DROPBAR: attributes of the up/down bars between multiple series of line chart group';
$103E: Result := 'RADAR: identifies a radar chart group';
$103F: Result := 'SURF: identifies a surface chart group';
$1040: Result := 'RADARAREA: identifies a filled radar chart group';
$1041: Result := 'AXISPARENT: Properties of an axis group';
$1043: Result := 'LEGENDEXCEPTION: Information on legend item changed from default';
$1044: Result := 'SHTPROPS: Chart properties defined by the Chart Sheet Substream ABNF';
$1045: Result := 'SERTOCRT: Specifies chart group for the current series';
$1046: Result := 'AXESUSED: Number of axis groups on the chart';
$1048: Result := 'SBASEREF: Location of a PivotTable view referenced by a chart';
$104A: Result := 'SERPARENT: Series to which the current trendline or error bar corresponds';
$104B: Result := 'SERAUXTREND: Specifies a trendline';
$104E: Result := 'IFMTRECORD: Number format to use for the text on an axis';
$104F: Result := 'POS: Size/position for legend, attached label, or plot area';
$1050: Result := 'ALRUNS: Rich Text Formatting within chart titles, trendline, and data labels';
$1051: Result := 'BRAI: Reference to data used in chart';
$105B: Result := 'SERAUXERRBAR: Error bar properties';
$105C: Result := 'CLRTCLIENT: Custom color palette for chart';
$105D: Result := 'SERFMT: Properties of series data points, markers, or lines';
$105F: Result := 'CHART3DBARSHAPE: Shape of the data points in bar or column chart group';
$1060: Result := 'FBI: Scalable font information (chart)';
$1061: Result := 'BOPPOP: Chart group is a bar or a pie of pie chart';
$1062: Result := 'AXCEXT: Additional extension properties of a date axis';
$1063: Result := 'DAT: Chart Sheet Substream ABNF for data table within chart area';
$1064: Result := 'PLOTGROWTH: Scale factors for font scaling';
$1065: Result := 'SIINDEX: Specifies data of a chart';
$1066: Result := 'GELFRAME: Properties of a fill pattern for parts of a chart';
$1067: Result := 'BOPPOPCUSTOM: Series data points contained in the secondary bar/pie';
$1068: Result := 'FBI2: Scalable font information (chart)';
else
Result := '<unknown>';
end;
end;
function SheetFuncName(AIndex: Word): String;
begin
case AIndex of
0 : result := 'COUNT';
1 : Result := 'IF';
2 : Result := 'ISNA';
3 : Result := 'ISERROR';
4 : Result := 'SUM';
5 : Result := 'AVERAGE';
6 : Result := 'MIN';
7 : Result := 'MAX';
8 : Result := 'ROW';
9 : Result := 'COLUMN';
10 : Result := 'NA';
11 : Result := 'NPV';
12 : Result := 'STDEV';
13 : Result := 'DOLLAR';
14 : Result := 'FIXED';
15 : Result := 'SIN';
16 : Result := 'COS';
17 : Result := 'TAN';
18 : Result := 'ATAN';
19 : Result := 'PI';
20 : Result := 'SQRT';
21 : Result := 'EXP';
22 : Result := 'LN';
23 : Result := 'LOG10';
24 : Result := 'ABS';
25 : Result := 'INT';
26 : Result := 'SIGN';
27 : Result := 'ROUND';
28 : Result := 'LOOKUP';
29 : Result := 'INDEX';
30 : Result := 'REPT';
31 : Result := 'MID';
32 : Result := 'LEN';
33 : Result := 'VALUE';
34 : Result := 'TRUE';
35 : Result := 'FALSE';
36 : Result := 'AND';
37 : Result := 'OR';
38 : Result := 'NOT';
39 : Result := 'MOD';
40 : Result := 'DCOUNT';
41 : Result := 'DSUM';
42 : Result := 'DAVERAGE';
43 : Result := 'DMIN';
44 : Result := 'DMAX';
45 : Result := 'DSTDEV';
46 : Result := 'VAR';
47 : Result := 'DVAR';
48 : Result := 'TEXT';
49 : Result := 'LINEST';
50 : Result := 'TREND';
51 : Result := 'LOGEST';
52 : Result := 'GROWTH';
56 : Result := 'PV';
57 : Result := 'FV';
58 : Result := 'NPER';
59 : Result := 'PMT';
60 : Result := 'RATE';
61 : Result := 'MIRR';
62 : Result := 'IRR';
63 : Result := 'RAND';
64 : Result := 'MATCH';
65 : Result := 'DATE';
66 : Result := 'TIME';
67 : Result := 'DAY';
68 : Result := 'MONTH';
69 : Result := 'YEAR';
70 : Result := 'WEEKDAY';
71 : Result := 'HOUR';
72 : Result := 'MINUTE';
73 : Result := 'SECOND';
74 : Result := 'NOW';
75 : Result := 'AREAS';
76 : Result := 'ROWS';
77 : Result := 'COLUMNS';
78 : Result := 'OFFSET';
82 : Result := 'SEARCH';
83 : Result := 'TRANSPOSE';
86 : Result := 'TYPE';
97 : Result := 'ATAN2';
98 : Result := 'ASIN';
99 : Result := 'ACOS';
100 : Result := 'CHOOSE';
101 : Result := 'HLOOKUP';
102 : Result := 'VLOOKUP';
105 : Result := 'ISREF';
109 : Result := 'LOG';
111 : Result := 'CHAR';
112 : Result := 'LOWER';
113 : Result := 'UPPER';
114 : Result := 'PROPER';
115 : Result := 'LEFT';
116 : Result := 'RIGHT';
117 : Result := 'EXACT';
118 : Result := 'TRIM';
119 : Result := 'REPLACE';
120 : Result := 'SUBSTITUTE';
121 : Result := 'CODE';
124 : Result := 'FIND';
125 : Result := 'CELL';
126 : Result := 'ISERR';
127 : Result := 'ISTEXT';
128 : Result := 'ISNUMBER';
129 : Result := 'ISBLANK';
130 : Result := 'T';
131 : Result := 'N';
140 : Result := 'DATEVALUE';
141 : Result := 'TIMEVALUE';
142 : Result := 'SLN';
143 : Result := 'SYD';
144 : Result := 'DDB';
148 : Result := 'INDIRECT';
162 : Result := 'CLEAN';
163 : Result := 'MDETERM';
164 : Result := 'MINVERSE';
165 : Result := 'MMULT';
167 : Result := 'IPMT';
168 : Result := 'PPMT';
169 : Result := 'COUNTA';
183 : Result := 'PRODUCT';
184 : Result := 'FACT';
189 : Result := 'DPRODUCT';
190 : Result := 'ISNONTEXT';
193 : Result := 'STDEVP';
194 : Result := 'VARP';
195 : Result := 'DSTDEVP';
196 : Result := 'DVARP';
197 : Result := 'TRUNC';
198 : Result := 'ISLOGICAL';
199 : Result := 'DCOUNTA';
204 : Result := 'YEN/USDOLLAR';
205 : Result := 'FINDB';
206 : Result := 'SEARCHB';
207 : Result := 'REPLACEB';
208 : Result := 'LEFTB';
209 : Result := 'RIGHTB';
210 : Result := 'MIDB';
211 : Result := 'LENB';
212 : Result := 'ROUNDUP';
213 : Result := 'ROUNDDOWN';
214 : Result := 'ASC';
215 : Result := 'JIS / DBCS';
216 : Result := 'RANK';
219 : Result := 'ADDRESS';
220 : Result := 'DAYS360';
221 : Result := 'TODAY';
222 : Result := 'VDB';
227 : Result := 'MEDIAN';
228 : Result := 'SUMPRODUCT';
229 : Result := 'SINH';
230 : Result := 'COSH';
231 : Result := 'TANH';
232 : Result := 'ASINH';
233 : Result := 'ACOSH';
234 : Result := 'ATANH';
235 : Result := 'DGET';
244 : Result := 'INFO';
247 : Result := 'DB';
252 : Result := 'FREQUENCY';
261 : Result := 'ERROR.TYPE';
269 : Result := 'AVEDEV';
270 : Result := 'BETADIST';
271 : Result := 'GAMMALN';
272 : Result := 'BETAINV';
273 : Result := 'BINOMDIST';
274 : Result := 'CHIDIST';
275 : Result := 'CHIINV';
276 : Result := 'COMBIN';
277 : Result := 'CONFIDENCE';
278 : Result := 'CRITBINOM';
279 : Result := 'EVEN';
280 : Result := 'EXPONDIST';
281 : Result := 'FDIST';
282 : Result := 'FINV';
283 : Result := 'FISHER';
284 : Result := 'FISHERINV';
285 : Result := 'FLOOR';
286 : Result := 'GAMMADIST';
287 : Result := 'GAMMAINV';
288 : Result := 'CEILING';
289 : Result := 'HYPGEOMDIST';
290 : Result := 'LOGNORMDIST';
291 : Result := 'LOGINV';
292 : Result := 'NEGBINOMDIST';
293 : Result := 'NORMDIST';
294 : Result := 'NORMSDIST';
295 : Result := 'NORMINV';
296 : Result := 'NORMSINV';
297 : Result := 'STANDARDIZE';
298 : Result := 'ODD';
299 : Result := 'PERMUT';
300 : Result := 'POISSON';
301 : Result := 'TDIST';
302 : Result := 'WEIBULL';
303 : Result := 'SUMXMY2';
304 : Result := 'SUMX2MY2';
305 : Result := 'SUMX2PY2';
306 : Result := 'CHITEST';
307 : Result := 'CORREL';
308 : Result := 'COVAR';
309 : Result := 'FORECAST';
310 : Result := 'FTEST';
311 : Result := 'INTERCEPT';
312 : Result := 'PEARSON';
313 : Result := 'RSQ';
314 : Result := 'STEYX';
315 : Result := 'SLOPE';
316 : Result := 'TTEST';
317 : Result := 'PROB';
318 : Result := 'DEVSQ';
319 : Result := 'GEOMEAN';
320 : Result := 'HARMEAN';
321 : Result := 'SUMSQ';
322 : Result := 'KURT';
323 : Result := 'SKEW';
324 : Result := 'ZTEST';
325 : Result := 'LARGE';
326 : Result := 'SMALL';
327 : Result := 'QUARTILE';
328 : Result := 'PERCENTILE';
329 : Result := 'PERCENTRANK';
330 : Result := 'MODE';
331 : Result := 'TRIMMEAN';
332 : Result := 'TINV';
336 : Result := 'CONCATENATE';
337 : Result := 'POWER';
342 : Result := 'RADIANS';
343 : Result := 'DEGREES';
344 : Result := 'SUBTOTAL';
345 : Result := 'SUMIF';
346 : Result := 'COUNTIF';
347 : Result := 'COUNTBLANK';
350 : Result := 'ISPMT';
351 : Result := 'DATEDIF';
352 : Result := 'DATESTRING';
353 : Result := 'NUMBERSTRING';
354 : Result := 'ROMAN';
358 : Result := 'GETPIVOTDATA';
359 : Result := 'HYPERLINK';
360 : Result := 'PHONETIC';
361 : Result := 'AVERAGEA';
362 : Result := 'MAXA';
363 : Result := 'MINA';
364 : Result := 'STDEVPA';
365 : Result := 'VARPA';
366 : Result := 'STDEVA';
367 : Result := 'VARA';
else Result := 'unknown';
end;
end;
end.

View File

@ -0,0 +1,245 @@
unit beHTML;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Graphics;
type
THTMLHeader = (h1, h2, h3, h4, h5);
THeaderColors = Array[THTMLHeader] of TColor;
THTMLDocument = class
private
FLines: TStrings;
FRawMode: Boolean;
FIndent: Integer;
function Indent: String;
function Raw(const AText: String): String;
function ColorToHTML(AColor: TColor): String;
public
constructor Create;
destructor Destroy; override;
procedure AddEmptyLine;
procedure AddListItem(const AText: String);
procedure AddHeader(AHeader: THTMLHeader; const AText: String);
procedure AddParagraph(const AText: String);
procedure BeginDocument(const ATitle: String; const AHeaderColors: THeaderColors;
ARawMode: Boolean=false);
procedure BeginBulletList;
procedure BeginNumberedList;
function Bold(const AText: String): String;
procedure EndDocument;
procedure EndBulletList;
procedure EndNumberedList;
function Hyperlink(const AText, ALink: String): String;
function Italic(const AText: String): String;
property Lines: TStrings read FLines;
end;
implementation
uses
StrUtils, LCLIntf;
constructor THTMLDocument.Create;
begin
inherited;
FLines := TStringList.Create;
end;
destructor THTMLDocument.Destroy;
begin
FLines.Free;
inherited;
end;
procedure THTMLDocument.AddHeader(AHeader: THTMLHeader; const AText: String);
begin
if FRawMode then
FLines.Add(Raw(AText))
else
FLines.Add(Format('%s<h%d>%s</h%d>', [Indent, ord(AHeader)+1, AText, ord(AHeader)+1]));
end;
(*
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- HTML Codes by Quackit.com -->
<title>
Title appears in the browser's title bar...</title>
<meta name="keywords" content="Separate keywords or phrases with a comma (example: html code generator, generate html, ...)">
<meta name="description" content="Make it nice and short, but descriptive. The description may appear in search engines' search results pages...">
<style type="text/css">
body {background-color:ffffff;background-image:url(http://);background-repeat:no-repeat;background-position:top left;background-attachment:fixed;}
h4{font-family:Arial;color:003366;}
p {font-family:Cursive;font-size:14px;font-style:normal;font-weight:normal;color:000000;}
</style>
</head>
<body>
<h4>Heading goes here...</h4>
<p>Enter your paragraph text here...</p>
</body>
</html>
*)
procedure THTMLDocument.BeginDocument(const ATitle: String;
const AHeaderColors: THeaderColors; ARawMode: Boolean = false);
begin
FRawMode := ARawMode;
FLines.Clear;
if not FRawMode then begin
FLines.Add('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
FLines.Add('<html>');
FLines.Add(' <head>');
FLines.Add(' <meta http-equiv="content-type" content="text/html; charset=UTF-8">');
FLines.Add(' <title>' + ATitle + '</title>');
FLines.Add(' <style type="text/css">');
FLines.Add(Format(
' h1{color:%s;}', [ColorToHTML(AHeaderColors[h1])]));
FLines.Add(Format(
' h2{color:%s;}', [ColorToHTML(AHeaderColors[h2])]));
FLines.Add(Format(
' h3{color:%s;}', [ColorToHTML(AHeaderColors[h3])]));
FLines.Add(Format(
' h4{color:%s;}', [ColorToHTML(AHeaderColors[h4])]));
FLines.Add(Format(
' h5{color:%s;}', [ColorToHTML(AHeaderColors[h5])]));
FLines.Add(' </style>');
FLines.Add(' </head>');
FLines.Add(' <body>');
FIndent := 4;
end;
end;
procedure THTMLDocument.BeginBulletList;
begin
if not FRawMode then begin
FLines.Add(Indent + '<ul>');
inc(FIndent, 2);
end;
end;
procedure THTMLDocument.BeginNumberedList;
begin
if not FRawMode then begin
FLines.Add(Indent + '<ol>');
inc(FIndent, 2);
end;
end;
procedure THTMLDocument.AddEmptyLine;
begin
if FRawMode then
FLines.Add('')
else
FLines.Add('<br>');
end;
procedure THTMLDocument.AddListItem(const AText: String);
begin
if FRawMode then
FLines.Add('- ' + Raw(AText))
else
FLines.Add(Indent + '<li>' + AText + '</li>');
end;
procedure THTMLDocument.AddParagraph(const AText: String);
begin
if FRawMode then
FLines.Add(Raw(AText))
else
FLines.Add(Indent + '<p>' + AText + '</p>');
end;
function THTMLDocument.Bold(const AText: String): String;
begin
if FRawMode then
Result := AText
else
Result := '<b>' + AText + '</b>';
end;
function THTMLDocument.ColorToHTML(AColor: TColor): String;
var
tmpRGB: LongInt;
begin
tmpRGB := ColorToRGB(AColor) ;
Result := Format('#%.2x%.2x%.2x', [
GetRValue(tmpRGB),
GetGValue(tmpRGB),
GetBValue(tmpRGB)
]) ;
end;
procedure THTMLDocument.EndDocument;
begin
if not FRawMode then begin
FLines.Add(' </body>');
FLines.Add('</html>');
end;
end;
procedure THTMLDocument.EndBulletList;
begin
if not FRawMode then begin
dec(FIndent, 2);
FLines.Add(Indent + '</ul>');
end;
end;
procedure THTMLDocument.EndNumberedList;
begin
if not FRawMode then begin
dec(FIndent, 2);
FLines.Add(Indent + '</ol>');
end;
end;
function THTMLDocument.Hyperlink(const AText, ALink: String): String;
begin
if FRawMode then
Result := Format('%s (%s)', [AText, ALink])
else
Result := Format('<a href="%s">%s</a>', [ALink, AText]);
end;
function THTMLDocument.Indent: String;
begin
Result := DupeString(' ', FIndent);
end;
function THTMLDocument.Italic(const AText: String): String;
begin
if FRawMode then
Result := AText
else
Result := '<i>' + AText + '</i>';
end;
function THTMLDocument.Raw(const AText: String): String;
var
i, n: Integer;
begin
Result := '';
if AText = '' then
exit;
n := Length(AText);
i := 1;
while (i <= n) do begin
if AText[i] = '<' then
repeat
inc(i);
until (i = n) or (AText[i] = '>')
else
Result := Result + AText[i];
inc(i);
end;
end;
end.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
unit beUtils;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, IniFiles, Forms;
function CreateIni : TCustomIniFile;
procedure ReadFormFromIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
procedure WriteFormToIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
implementation
function CreateIni : TCustomIniFile;
var
cfg : string;
begin
cfg := GetAppConfigDir(false);
if not DirectoryExists(cfg) then
CreateDir(cfg);
result := TMemIniFile.Create(GetAppConfigFile(false));
end;
procedure ReadFormFromIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
var
L,T,W,H: Integer;
isMax: Boolean;
begin
L := ini.ReadInteger(ASection, 'Left', AForm.Left);
T := Ini.ReadInteger(ASection, 'Top', AForm.Top);
W := ini.ReadInteger(ASection, 'Width', AForm.Width);
H := ini.ReadInteger(ASection, 'Height', AForm.Height);
isMax := ini.ReadBool(ASection, 'Maximized', AForm.WindowState = wsMaximized);
if W > Screen.Width then W := Screen.Width;
if H > Screen.Height then H := Screen.Height;
if L < 0 then L := 0;
if T < 0 then T := 0;
if L + W > Screen.Width then L := Screen.Width - W;
if T + H > Screen.Height then T := Screen.Height - H;
AForm.Left := L;
AForm.Top := T;
AForm.Width := W;
AForm.Height := H;
if IsMax then
AForm.WindowState := wsMaximized
else
AForm.WindowState := wsNormal;
end;
procedure WriteFormToIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
begin
ini.WriteBool(ASection, 'Maximized', (AForm.WindowState = wsMaximized));
if AForm.WindowState = wsNormal then begin
ini.WriteInteger(ASection, 'Left', AForm.Left);
ini.WriteInteger(ASection, 'Top', AForm.Top);
ini.WriteInteger(ASection, 'Width', AForm.Width);
ini.WriteInteger(ASection, 'Height', AForm.Height);
end;
end;
end.

View File

@ -0,0 +1,485 @@
{ MRU (Most Recent Used) menu item manager
Copyright (C) 2011 Michael Van Canneyt (michael@freepascal.org)
Modifications by Werner Pamler
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
modified by wp
}
unit mrumanager;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, inifiles, menus;
Type
{ TRecentMenuItem }
TRecentMenuItem = Class(TMenuItem)
Private
FFileName : string;
Public
Property FileName : String Read FFileName;
end;
TRecentMenuItemClass = Class of TRecentMenuItem;
{ TMRUMenuManager }
TOnRecentFileEvent = Procedure(Sender : TObject; Const AFileName : String) of object;
TMRUMenuManager = Class(TComponent)
Private
FIniFileName: String;
FIniSection: String;
FOnRecent: TOnRecentFileEvent;
FRecent : TStrings;
FMaxRecent : Integer;
FMenuCaptionMask : string;
FMIRecent : TMenuItem;
FPMRecent : TPopupMenu;
FMaxItemLength : integer;
procedure SetIniFileName(const AValue:string);
procedure SetIniSection(const AValue:string);
procedure SetMaxItemLength(const AValue:integer);
procedure SetMenuCaptionMask(const AValue:string);
procedure SetMIRecent(const AValue: TMenuItem);
procedure SetPMRecent(const AValue: TPopupMenu);
procedure SetRecent(const AValue: TStrings);
protected
// Overrides.
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
// Return default name and section if either is empty.
procedure GetFileNameAndSection(Var AFileName,ASection : String); virtual;
// Override if you want to load additional values.
procedure LoadFromIni(Ini: TCustomIniFile; ASection: String); virtual;
// Override if you want to write additional values.
procedure SaveToIni(Ini: TCustomIniFile; ASection: String); virtual;
// Called when menu item is clicked.
procedure DoOnRecentClick(Sender: TObject); virtual;
// Override this if you want to create a custom class of menu itel.
function CreateMenuItem(AOwner: TComponent): TRecentMenuItem; virtual;
// Create a menu caption. Default is index followed by filename.
// Override if you want to customize.
Function CreateMenuCaption(AIndex : Integer; Const AFileName : String) : String; virtual;
Public
Constructor Create(AOwner : TComponent);override;
Destructor Destroy; override;
// Load files from ini file AFileName in section ASection. Calls ShowRecentFiles
// Need for explicit call only when IniFileName='' and IniSection='' and class created at run-time
procedure LoadRecentFilesFromIni(const AFileName: string=''; const ASection: String='');
// Saves files to ini file AFileName in section ASection.
procedure SaveRecentFilesToIni(const AFileName: string=''; const ASection: String='');
// Add a filename to the list of files.
// If an existing file is added, it is moved first in the list.
// If MaxRecent is attained, the last one is removed.
// Calls ShowRecentFiles.
procedure AddToRecent(AFileName: String);
// Re-populate the menu.
procedure ShowRecentFiles;
Published
// Max. items to be kept in the list.
Property MaxRecent : Integer Read FMaxRecent write FMaxRecent;
// Menu item to create a submenu under. Existing items will be removed.
Property MenuItem : TMenuItem Read FMIRecent Write SetMIRecent;
// Popupmenu attached to a toolbar button. Existing items will be removed.
Property PopupMenu : TPopupMenu Read FPMRecent Write SetPMRecent;
// Default ini filename.
Property IniFileName : String Read FIniFileName Write SetIniFileName;
// Default ini section.
Property IniSection : String Read FIniSection Write SetIniSection;
// Maximum length of recent menu item
Property MaxItemLength : integer Read FMaxItemLength Write SetMaxItemLength default 80;
// Format mask for MenuCaption: first placeholder must be %d, second %s, e.g. '%d - %s'
Property MenuCaptionMask : string read FMenuCaptionMask Write SetMenuCaptionMask;
// Recent items. If adding manually to the list, ShowRecentFiles must be called manually.
Property Recent : TStrings Read FRecent Write SetRecent;
// Called when the user clicks an recent meu item.
Property OnRecentFile : TOnRecentFileEvent Read FOnRecent Write FOnRecent;
end;
EMRUManager = Class(Exception);
Const
DefaultIniFile = 'recent.ini';
DefaultSection = 'Global';
KeyMaxRecent = 'MaxRecent';
KeyCount = 'Count';
KeyFile = 'File%d';
implementation
Resourcestring
SErrFailedToCreateDir = 'Failed to create directory "%s"';
const
DEFAULT_MASK = '%d. %s';
function MinimizeFileName(const AFileName:string; AMaxLen:integer) : string;
procedure SplitPath(const APath:String; Parts: TStrings);
{ Splits the provided path into constituent folder names }
var
i, j : Integer;
begin
if APath = '' then exit;
if not Assigned(Parts) then exit;
i := Length(APath);
j := i;
while (i >= 1) do begin
if APath[i] = DirectorySeparator then begin
Parts.Insert(0, copy(APath, i+1, j-i));
j := i;
end;
dec(i);
end;
Parts.Insert(0, copy(APath, 1, j));
end;
function AddStringsFromTo(AList:TStrings; FromIndex,ToIndex:integer) : string;
var
i : integer;
begin
result := '';
for i:=FromIndex to ToIndex do
result := result + AList[i];
end;
var
Parts : TStringList;
i : integer;
tmp : string;
begin
result := AFileName;
if Length(AFileName) > AMaxLen then begin
Parts := TStringList.Create;
try
SplitPath(AFileName, Parts);
i := Parts.Count div 2;
while (i < Parts.Count) do begin
tmp := Format('%s...%s%s', [
AddStringsFromTo(Parts, 0, i-1),
DirectorySeparator,
AddStringsFromTo(Parts, i+1, Parts.Count-1)
]);
if Length(tmp) < AMaxLen then begin
result := tmp;
exit;
end else
Parts.Delete(i);
i := Parts.Count div 2;
end;
result := ExtractFileName(AFileName);
finally
Parts.Free;
end;
end;
end;
procedure TMRUMenuManager.AddToRecent(AFileName : String);
Var
I,J : Integer;
B : Boolean;
begin
AFileName:=ExpandFileName(AFileName);
With FRecent do
begin
J:=IndexOf(AFileName);
If (J<>-1) then
begin
if (J>0) then
Exchange(0,J)
end
else
begin
While (Count>=FMaxRecent) do
Delete(Count-1);
Insert(0,AFileName)
end;
end;
ShowRecentFiles;
end;
function TMRUMenuManager.CreateMenuItem(AOwner :TComponent) : TRecentMenuItem;
begin
Result:=TRecentMenuItem.Create(AOwner);
end;
function TMRUMenuManager.CreateMenuCaption(AIndex: Integer;
const AFileName: String): String;
var
fn : string;
mask : string;
begin
if FMaxItemLength > 0 then
fn := MinimizeFileName(AFileName, FMaxItemLength)
else
fn := AFileName;
if FMenuCaptionMask = '' then
mask := DEFAULT_MASK
else
mask := FMenuCaptionMask;
Result:=Format(mask, [AIndex+1,fn]);
end;
procedure TMRUMenuManager.ShowRecentFiles;
Var
I : Integer;
M : TRecentMenuItem;
begin
if Assigned(FMIRecent) then begin
FMIRecent.clear;
For I:=0 to FRecent.Count-1 do
begin
M:=CreateMenuItem(Self.Owner);
M.Caption:=CreateMenuCaption(I,FRecent[i]);
M.FFileName:=FRecent[i];
M.OnClick:=@DoOnRecentClick;
FMIRecent.Add(M);
end;
end;
if Assigned(FPMRecent) then begin
FPMRecent.Items.Clear;
for i:=0 to FRecent.Count-1 do
begin
M := CreateMenuItem(Self.Owner);
M.Caption := CreateMenuCaption(I, Recent[i]);
M.FFileName := FRecent[i];
M.OnClick := @DoOnRecentClick;
FPMRecent.Items.Add(M);
end;
end;
end;
procedure TMRUMenuManager.LoadFromIni(Ini : TCustomIniFile; ASection : String);
Var
I,Count : Integer;
FN : String;
begin
FRecent.Clear;
FMaxRecent:=Ini.ReadInteger(ASection,KeyMaxRecent,10);
Count:=Ini.ReadInteger(ASection,KeyCount,0);
For I:=1 to Count do
begin
FN:=Ini.ReadString(ASection,Format(KeyFile,[i]),'');
If (FN<>'') then
FRecent.Add(FN);
end;
end;
procedure TMRUMenuManager.GetFileNameAndSection(var AFileName, ASection: String);
begin
if (AFileName='') then
begin
AFileName:=GetAppConfigDir(False);
AFileName:=IncludeTrailingPathDelimiter(AFileName)+DefaultIniFile;
end;
if (ASection='') then
ASection:=DefaultSection;
end;
procedure TMRUMenuManager.LoadRecentFilesFromIni(Const AFileName : string = ''; Const ASection : String = '');
Var
DN,FN,Sec : String;
Ini : TIniFile;
begin
FN:=AFileName;
Sec:=ASection;
GetFileNameAndSection(FN,Sec);
DN:=ExtractFilePath(FN);
If ForceDirectories(DN) then
begin
If FileExists(FN) then
begin
Ini:=TIniFile.Create(FN);
try
LoadFromIni(Ini,Sec);
finally
Ini.Free;
end;
end;
end;
ShowRecentFiles;
end;
procedure TMRUMenuManager.SaveToIni(Ini : TCustomIniFile; ASection : String);
Var
I : Integer;
begin
Ini.EraseSection(ASection);
Ini.WriteInteger(ASection,KeyMaxRecent,FMaxRecent);
Ini.WriteInteger(ASection,KeyCount,FRecent.Count);
For I:=0 to FRecent.Count-1 do
Ini.WriteString(ASection,Format(KeyFile,[i+1]),FRecent[i]);
Ini.UpdateFile;
end;
procedure TMRUMenuManager.SaveRecentFilesToIni(Const AFileName : string = ''; Const ASection : String = '');
Var
DN,FN,Sec : String;
Ini : TMemIniFile;
begin
FN:=AFileName;
Sec:=ASection;
GetFileNameAndSection(FN,Sec);
DN:=ExtractFilePath(FN);
If not ForceDirectories(DN) then
Raise EMRUManager.CreateFmt(SErrFailedToCreateDir,[DN]);
Ini:=TMemIniFile.Create(FN);
try
SaveToIni(Ini,Sec);
finally
Ini.Free;
end;
end;
procedure TMRUMenuManager.SetIniFileName(const AValue:string);
begin
if AValue <> FIniFileName then begin
FIniFileName := AValue;
LoadRecentFilesFromIni(FIniFileName, FIniSection);
end;
end;
procedure TMRUMenuManager.SetIniSection(const AValue:string);
begin
if AValue <> FIniSection then begin
FIniSection := AValue;
LoadRecentFilesFromini(FIniFileName, FIniSection);
end;
end;
procedure TMRUMenuManager.SetMaxItemLength(const AValue:integer);
begin
if FMaxItemLength <> AValue then begin
FMaxItemLength := AValue;
ShowRecentFiles;
end;
end;
procedure TMRUMenuManager.SetMenuCaptionMask(const AValue:string);
begin
if FMenuCaptionMask <> AValue then begin
FMenuCaptionMask := AValue;
ShowRecentFiles;
end;
end;
procedure TMRUMenuManager.SetMIRecent(const AValue: TMenuItem);
begin
if FMIRecent=AValue then exit;
If Assigned(FMIRecent) then
FMIRecent.RemoveFreeNotification(Self);
FMIRecent:=AValue;
If Assigned(FMIRecent) then
FMIRecent.FreeNotification(Self);
ShowRecentFiles;
end;
procedure TMRUMenuManager.SetPMRecent(const AValue: TPopupMenu);
begin
if FPMRecent=AValue then exit;
if Assigned(FPMRecent) then
FPMRecent.RemoveFreeNotification(self);
FPMRecent := AValue;
if Assigned(FPMRecent) then
FPMRecent.FreeNotification(self);
ShowRecentFiles;
end;
procedure TMRUMenuManager.SetRecent(const AValue: TStrings);
begin
if FRecent=AValue then exit;
FRecent.Assign(AValue);
ShowRecentFiles;
end;
procedure TMRUMenuManager.loaded;
begin
inherited loaded;
if (FRecent.Count>0) and (assigned(FMIRecent) or assigned(FPMRecent))then
LoadRecentFilesFromIni(FIniFileName, FIniSection);
end;
constructor TMRUMenuManager.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FRecent:=TStringList.Create;
FMaxItemLength := 80;
FMenuCaptionMask := DEFAULT_MASK;
end;
destructor TMRUMenuManager.Destroy;
begin
SaveRecentFilesToIni(FIniFileName, FIniSection);
FreeAndNil(FRecent);
inherited Destroy;
end;
procedure TMRUMenuManager.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) then begin
if AComponent = FMIRecent then FMIRecent := nil;
if AComponent = FPMRecent then FPMRecent := nil;
end;
{ original code - I think this is not correct:
inherited Notification(AComponent, Operation);
if (Operation=opRemove) and ((AComponent=FMIRecent) or (AComponent=FPMRecent)) then
exit;
}
end;
procedure TMRUMenuManager.DoOnRecentClick(Sender: TObject);
Var
FN : String;
begin
With (Sender as TRecentMenuItem) do
FN:=FileName;
if (FN<>'') and (OnRecentFile<>Nil) then
OnRecentFile(Self,FN);
end;
end.

View File

@ -0,0 +1,18 @@
BIFF Explorer
--------------------------------------------------------------------------------
"BIFF Explorer" is a tool to peek into the internal structure of a binary
Excel file in biff format.
It displays a list of the BIFF records contained in the xls file along with
name and explanation as described in various documentation files (see "About").
Selecting one of the records loads its bytes into a simple hex viewer; for the
most important records I tried to decipher the contents of the hex values and
display their meaning in a grid and a memo (page "Analysis"). For the other
records select a byte in the hex viewer, and the program will display the
contents of that byte and the following ones as integer, double, string
(page "Values").
For compiling, note that the program requires the package "VirtualTreeview-new"
from ccr (which in turn requires the package "lclextensions" from
http://code.google.com/p/luipack/downloads/list).