📄 formattedobj2.pas
字号:
unit FormattedObj2;
{
********************************************************************************
******* XLSReadWriteII V2.00 *******
******* *******
******* Copyright(C) 1999,2004 Lars Arvidsson, Axolot Data *******
******* *******
******* email: components@axolot.com *******
******* URL: http://www.axolot.com *******
********************************************************************************
** Users of the XLSReadWriteII component must accept the following **
** disclaimer of warranty: **
** **
** XLSReadWriteII is supplied as is. The author disclaims all warranties, **
** expressedor implied, including, without limitation, the warranties of **
** merchantability and of fitness for any purpose. The author assumes no **
** liability for damages, direct or consequential, which may result from the **
** use of XLSReadWriteII. **
********************************************************************************
}
{$B-}
interface
uses Classes, SysUtils, Graphics, BIFFRecsII2, XLSFonts2, CellFormats2;
//: Base class for object that can be formatted, such as cells, rows and
//: columns. If you want to format all cells in a row or a column, format
//: the row or the column then. Formatting all individual cells is much more
//: innefficient.
type TFormattedObject = class(TObject)
protected
FFormats: TCellFormats;
FFormat: TCellFormat;
function GetFillPatternBackColor: TExcelColor;
function GetFillPatternForeColor: TExcelColor;
function GetHorizAlignment: TCellHorizAlignment;
procedure SetHorizAlignment(const Value: TCellHorizAlignment);
function GetBorderBottomColor: TExcelColor;
function GetBorderBottomStyle: TCellBorderStyle;
function GetBorderDiagColor: TExcelColor;
function GetBorderDiagLines: TDiagLines;
function GetBorderDiagStyle: TCellBorderStyle;
function GetBorderLeftColor: TExcelColor;
function GetBorderLeftStyle: TCellBorderStyle;
function GetBorderRightColor: TExcelColor;
function GetBorderRightStyle: TCellBorderStyle;
function GetBorderTopColor: TExcelColor;
function GetBorderTopStyle: TCellBorderStyle;
function GetFormatOptions: TFormatOptions;
function GetIndent: byte;
function GetNumberFormat: WideString;
function GetProtection: TCellProtections;
function GetRotation: smallint;
function GetVertAlignment: TCellVertAlignment;
function GetFillPatternPattern: TExcelFillPattern;
function GetFontIndex: word;
function GetFontStyle: TXFontStyles;
function GetFontCharset: TFontCharset;
function GetFontColor: TExcelColor;
function GetFontFamily: byte;
function GetFontName: WideString;
function GetFontSize: integer;
function GetFontSize20: integer;
function GetFontSubSuperScript: TXSubSuperscript;
function GetFontUnderline: TXUnderline;
function GetFormatIndex: word;
procedure SetFillPatternBackColor(const Value: TExcelColor); virtual;
procedure SetFillPatternForeColor(const Value: TExcelColor); virtual;
procedure SetBorderBottomColor(const Value: TExcelColor); virtual;
procedure SetBorderBottomStyle(const Value: TCellBorderStyle); virtual;
procedure SetBorderDiagColor(const Value: TExcelColor); virtual;
procedure SetBorderDiagLines(const Value: TDiagLines); virtual;
procedure SetBorderDiagStyle(const Value: TCellBorderStyle); virtual;
procedure SetBorderLeftColor(const Value: TExcelColor); virtual;
procedure SetBorderLeftStyle(const Value: TCellBorderStyle); virtual;
procedure SetBorderRightColor(const Value: TExcelColor); virtual;
procedure SetBorderRightStyle(const Value: TCellBorderStyle); virtual;
procedure SetBorderTopColor(const Value: TExcelColor); virtual;
procedure SetBorderTopStyle(const Value: TCellBorderStyle); virtual;
procedure SetFFormatOptions(const Value: TFormatOptions); virtual;
procedure SetIndent(const Value: byte); virtual;
procedure SetNumberFormat(const Value: WideString); virtual;
procedure SetProtection(const Value: TCellProtections); virtual;
procedure SetRotation(const Value: smallint); virtual;
procedure SetVertAlignment(const Value: TCellVertAlignment); virtual;
procedure SetFillPatternPattern(const Value: TExcelFillPattern); virtual;
procedure SetFontCharset(const Value: TFontCharset); virtual;
procedure SetFontColor(const Value: TExcelColor); virtual;
procedure SetFontFamily(const Value: byte); virtual;
procedure SetFontName(const Value: WideString); virtual;
procedure SetFontSize(const Value: integer); virtual;
procedure SetFontSize20(const Value: integer); virtual;
procedure SetFontSubSuperScript(const Value: TXSubSuperscript); virtual;
procedure SetFontUnderline(const Value: TXUnderline); virtual;
procedure SetFontStyle(const Value: TXFontStyles); virtual;
procedure UpdateFormat(NewFormat: TCellFormat);
procedure UpdateFont(NewFont: TXFont);
public
constructor Create(Formats: TCellFormats; FormatIndex: word);
//: For internal use.
procedure AssignFormat(FormatIndex: word); overload;
//: For internal use.
procedure AssignFormat(Format: TCellFormat); overload;
//: For internal use.
procedure AssignFont(Font: TFont); overload;
//: Resets the format to default settings.
procedure SetDefaultFormat;
//: Copies the font (TXFont) of the format to a TFont object.
procedure CopyToTFont(Font: TFont);
//: Returns True if the object has formatting that differs from the default.
function IsFormatted: boolean;
property Formats: TCellFormats read FFormats;
//:# The index into the Formats array.
//: Description: It shall be avioded to use FormatIndex in order to change the
//: a format, as changing a format trough the Formats property will affect all
//: cells that shares that format.
//: For internal use.
property FormatIndex: word read GetFormatIndex;
//: For internal use.
property FontIndex: word read GetFontIndex;
//: Protection of cells.
property Protection: TCellProtections read GetProtection write SetProtection;
//: Horizontal alignment of text in cells.
property HorizAlignment: TCellHorizAlignment read GetHorizAlignment write SetHorizAlignment;
//: Vertical alignment of text in cells.
property VertAlignment: TCellVertAlignment read GetVertAlignment write SetVertAlignment;
//:# Text indent
//: The indent values can range from 0-15. A value of 0 (zero) is no
//: indent. An increase with one increases the indent with about one character.
property Indent: byte read GetIndent write SetIndent;
//:# Rotation of cell text.
//: Rotation, in degrees. <br>
//: The value 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -