📄 tmsuflxmessages.pas
字号:
/// <summary>
/// Universal Naming convention. For example: \\server\path\file.ext
/// </summary>
hl_UNC,
/// <summary>
/// An hyperlink inside the current file.
/// </summary>
hl_CurrentWorkbook);
/// <summary>
/// An encapsulation of an Excel hyperlink.
/// </summary>
THyperLink= record
/// <summary>
/// The type of hyperlink: to a local file, to an url, to a cell or to a networked file.
/// </summary>
LinkType: THyperLinkType;
/// <summary>
/// Text of the HyperLink. This is empty when linking to a cell.
/// </summary>
Description: UTF16String;
/// <summary>
/// Description of the HyperLink.
/// </summary>
TargetFrame: UTF16String;
/// <summary>
/// When entering an URL on excel, you can enter additional text following the url with a "#" character (for example www.your_url.com#myurl") The text Mark is the text after the "#" char. When entering an address to a cell, the address goes here too.
/// </summary>
TextMark: UTF16String;
/// <summary>
/// This parameter is not documented. You can leave it empty.
/// </summary>
Text: UTF16String;
/// <summary>
/// Hint when the mouse hovers over the hyperlink.
/// </summary>
Hint: UTF16String;
end;
type
/// <summary>
/// Event associated with <see cref="TCustomFlexCelReport.OnGetFilename" />.
/// </summary>
TOnGetFileNameEvent = procedure (Sender: TObject; const FileFormat: integer; var Filename: TFileName) of object;
/// <summary>
/// Event associated with <see cref="TCustomFlexCelReport.OnGetOutStream" />.
/// </summary>
TOnGetOutStreamEvent = procedure (Sender: TObject; const FileFormat: integer; var OutStream: TStream) of object;
/// <summary>
/// Possible image types on an excel sheet.
/// </summary>
TXlsImgTypes = (
/// <summary>
/// Enhanced Windows Metafile. This is a Vectorial image format.
/// </summary>
xli_Emf,
/// <summary>
/// Windows Metafile. This is a Vectorial image format.
/// </summary>
xli_Wmf,
/// <summary>
/// JPEG Image. This is a losely compressed bitmap, best suited for photos.
/// </summary>
xli_Jpeg,
/// <summary>
/// Portable Network Graphics. This is a lossless compressed bitmap, best suited for text.
/// </summary>
xli_Png,
/// <summary>
/// Windows Bitmap. As this is not compressed, don't use it except for really small images.
/// </summary>
xli_Bmp,
/// <summary>
/// Unsupported image format.
/// </summary>
xli_Unknown);
VariantArray=Array [0..maxint div sizeof(Variant)-1]of variant;
ArrayOfVariant=Array of Variant;
/// <summary>
/// Encapsulates the value in a cell.
/// </summary>
TXlsCellValue= record
/// <summary> Value of the cell </summary>
Value: variant;
/// <summary> Index to the Format for the cell. </summary>
XF: integer;
/// <summary> True if the cell contains a formula. If this is the case, you need to use CellFormula to read the value. </summary>
IsFormula: boolean;
end;
{$IFDEF NOFORMATSETTINGS}
/// <summary>
/// This record is a placeholder for older Delphi versions that don't have FormatSettings defined for
/// handling different locales.
/// </summary>
TFormatSettings = record
end;
{$ENDIF}
PFormatSettings = ^TFormatSettings;
///<summary> Defines how an image is anchored to the sheet.</summary>
TFlxAnchorType=(
///<summary>Move and resize the image when inserting rows or columns.</summary>
at_MoveAndResize,
///<summary>Move but don't resize the image when inserting rows or columns.</summary>
at_MoveAndDontResize,
/// <summary>
/// Don't move and don't resize the image when inserting rows or columns.
/// </summary>
at_DontMoveAndDontResize);
/// <summary>
/// Image information for a normal image.
/// </summary>
TImageProperties=record
/// <summary>
/// First column of object
/// </summary>
Col1: integer;
/// <summary>
/// Delta x of image, on 1/1024 of a cell. 0 means totally at the left, 512 on half of the cell, 1024 means at the left of next cell.
/// </summary>
dx1: integer;
/// <summary>
/// First Row of object.
/// </summary>
Row1: integer;
/// <summary>
/// Delta y of image on 1/255 of a cell. 0 means totally at the top, 128 on half of the cell, 255 means at the top of next cell.
/// </summary>
dy1: integer;
/// <summary>
/// Last column of object.
/// </summary>
Col2: integer;
/// <summary>
/// Delta x of image, on 1/1024 of a cell. 0 means totally at the left, 512 on half of the cell, 1024 means at the left of next cell.
/// </summary>
dx2: integer;
/// <summary>
/// Last row of object.
/// </summary>
Row2: integer;
/// <summary>
/// Delta y of image on 1/255 of a cell. 0 means totally at the top, 128 on half of the cell, 255 means at the top of next cell.
/// </summary>
dy2: integer;
/// <summary>
/// FileName of the image. It sets/gets the original filename of the image before it was inserted.
/// (For example: c:\image.jpg) It is not necessary to set this field, and when the image is not inserted
/// from a file but pasted, Excel does not set it either.
/// </summary>
FileName: UTF16String;
end;
/// <summary>
/// This method will search for a file in the disk.
/// </summary>
/// <remarks>
/// You can use this method to quickly find files in your application folder.<para></para>
/// <para></para>
/// The order in which this method will search for the file is:<para></para>
/// 1) If the path is an absolute path, it will return it.<para></para>
/// 2) If the path is relative, it will first search for it in the folder where the application is.<para></para>
/// 3) If it couldn't find it, it will search for the file in the folder where the package is, if FlexCel
/// is in a package. This might be useful if you are running for example in IIS where the the path for
/// the Application is the path for IIS and not for your dll.
/// </remarks>
/// <param name="AFileName">FileName we want to find.</param>
/// <returns>
/// Fully qualified filename and path to the file.
/// </returns>
function SearchPathStr(const AFileName: String): String; overload;
/// <summary>
/// This method will search for a file in the disk.
/// </summary>
/// <remarks>
/// You can use this method to quickly find files in your application folder.<para></para>
/// <para></para>
/// The order in which this method will search for the file is:<para></para>
/// 1) If AFileName is an absolute path, it will return it.<para></para>
/// 2) If AFilePath is not empty, this method will look for AFIleName in AFilePath.<para></para>
/// 3) If AFilePath is empty and AFileName is relative, it will first search for it in the folder where the application is.<para></para>
/// 4) If it couldn't find it in 3), it will search for the file in the folder where the package is, if FlexCel
/// is in a package. This might be useful if you are running for example in IIS where the the path for
/// the Application is the path for IIS and not for your dll.
/// </remarks>
/// <param name="AFilePath">Path to append before AFileName. If this string is empty, FlexCel will
/// search in the application path.</param>
/// <param name="AFileName">FileName we want to find.</param>
/// <returns>
/// Fully qualified filename and path to the file.
/// </returns>
function SearchPathStr(const AFilePath, AFileName: String): String; overload;
{$IFDEF VER130}
function IncludeTrailingPathDelimiter(const S: string): string;
function VarIsClear(const v: variant): boolean;
function TryStrToInt(const s: string; var i: integer): boolean;
function TryStrToFloat(const s: string; var i: extended): boolean;
{$ENDIF}
/// <summary>
/// A simple helper function that will convert a variant to a widestring in Delphi < 2009, and
/// to an UnicodeString for Delphi >= 2009
/// </summary>
/// <remarks>
/// This method is used internally by FlexCel.
/// </remarks>
/// <param name="v">Variant we want to convert.</param>
/// <returns>
/// The converted string.
/// </returns>
function VariantToString(const v: variant): UTF16String;
{$IFDEF NOFORMATSETTINGS}
procedure GetLocaleFormatSettings(LCID: Integer; var FormatSettings: TFormatSettings);
{$ENDIF}
procedure EnsureAMPM(var FormatSettings: PFormatSettings);
/// <summary>
/// Tries to convert a string to a float in an invariant culture. This means "." is <b>always</b>
/// decimal separator.
/// </summary>
/// <remarks>
/// This method is used internally by FlexCel.
/// </remarks>
/// <param name="s">String we want to convert, in English locale.</param>
/// <param name="i">\Returns the converted value.</param>
/// <returns>
/// True if the string was successfully converted.
/// </returns>
function TryStrToFloatInvariant(const s: string; out i: extended): boolean;
{$IFDEF FLX_NEEDSPOSEX}
function PosEx(const SubStr, S: UTF16String; Offset: Cardinal): Integer;
{$ENDIF} //Delphi 6
function WideUpperCase98(const s: UTF16String):UTF16String;
function StringReplaceSkipQuotes(const S, OldPattern, NewPattern: UTF16String): UTF16String;
/// <summary>
/// Tries to convert a string to a TDateTime.
/// </summary>
/// <remarks>
/// This routine uses the locale in the machine where the application is running to try to guess the
/// correct date.<para></para>
/// This means for example that if your locale is "dd/mm/yyyy" the date 5/8/2004 will be
/// converted to Agust 5, 2004, while if you have "mm/dd/yyyy" the date will be May 8, 2004.
/// </remarks>
/// <param name="S">String with the date.</param>
/// <param name="Value">S converted to a TDateTime.</param>
/// <param name="dFormat">\Returns the date format used to convert.</param>
/// <param name="HasDate">\Returns true if the string has a date format.</param>
/// <param name="HasTime">\Returns true if the string had a time format.</param>
/// <param name="DateFormat">Optional parameter. If you specify a string here like "dd/mm/yyyy"
/// this will be returned in dformat if the string contains a date.</param>
/// <param name="TimeFormat">Optional parameter. If you specify a string here like "hh\:mm\:ss"
/// this will be returned in dformat if the string contains time.</param>
/// <returns>
/// True if the string could be converted, false otherwise.<para></para>
///
/// </returns>
function FlxTryStrToDateTime(const S: UTF16String; out Value: TDateTime; out dFormat: UTF16String; out HasDate, HasTime: boolean; const DateFormat: UTF16String=''; const TimeFormat: UTF16String=''): Boolean;
/// <property name="flag" value="deprecated" />
///
/// <summary>
/// This method has been deprecated. Use <see cref="TryFormatDateTime1904@string@TDateTime@boolean" text="TryFormatDateTime1904" />
/// instead.
/// </summary>
/// <remarks>
/// Excel has two different date systems: one starts at 1900 and the other at 1904. While 1900 is the
/// most common (it is the default in Windows), 1904 is used in Macs and also might be set in Excel for
/// Windows too in the options dialog.<para></para>
/// <para></para>
/// This method assumes always 1900 dates, so it is not safe to use and you should use "1904"
/// overloads instead.
/// </remarks>
/// <param name="Fmt">Excel format to apply to the date.</param>
/// <param name="value">DateTime we want to format.</param>
/// <returns>
/// A string with the formatted datetime.
/// </returns>
function TryFormatDateTime(const Fmt: string; value: TDateTime): string; deprecated {$IFDEF FLX_HAS_DEPRECATED_COMMENTS}'Use TryFormatDateTime1904 instead'{$ENDIF};
/// <summary>
/// Converts a datetime value to a formatted string, using Excel format strings.
/// </summary>
/// <remarks>
/// This method correctly handles 1904 dates, so it should be used instead of TryFormatDateTime.
/// </remarks>
/// <param name="Fmt">Format string in Excel notation. (something like "dd/mmm/yyyyy hh\:ss")</param>
/// <param name="value">DateTime we want to format.</param>
/// <param name="Dates1904">A boolean indicating if the workbook uses 1904 or 1900 dates. <b>Note that
/// the result will be different depending on this parameter.</b> You will
/// normally get the value for this parameter from
/// TFlexCelImport.Options1904Dates</param>
/// <returns>
/// The datetime formatted as a string.<para></para>
///
/// </returns>
function TryFormatDateTime1904(const Fmt: string; value: TDateTime; const Dates1904: boolean): string; overload;
/// <summary>
/// Converts a datetime value to a formatted string, using Excel format strings.
/// </summary>
/// <remarks>
/// This method correctly handles 1904 dates, so it should be used instead of TryFormatDateTime.
/// </remarks>
/// <param name="Fmt">Format string in Excel notation. (something like "dd/mmm/yyyyy
/// hh\:ss")</param>
/// <param name="value">DateTime we want to format.</param>
/// <param name="Dates1904">A boolean indicating if the workbook uses 1904 or 1900 dates. <b>Note
/// that the result will be different depending on this parameter.</b> You
/// will normally get the value for this parameter from
/// TFlexCelImport.Options1904Dates</param>
/// <param name="LocalSettings">Locale settings used for the conversion. If for example the locale is
/// Spanish, the resulting string might be "5 de Abril" instead of
/// "April 5"</param>
/// <returns>
/// The datetime formatted as a string.
/// </returns>
function TryFormatDateTime1904(const Fmt: string; value: TDateTime; const Dates1904: boolean; const LocalSettings: TFormatSettings): string; overload;
/// <summary>
/// Increments a Cell range by an offset.
/// </summary>
/// <remarks>
/// This is a simple method that will take a cell range, increment its columns and rows by a given
/// value, and return the new range.
/// </remarks>
/// <param name="CellRange">Original cell range</param>
/// <param name="DeltaRow">Rows to add to the range (both top and bottom rows)</param>
/// <param name="DeltaCol">Columns to add to the range (both left and right columns)</param>
/// <returns>
/// A new range with the rows and columns incremented or decremented.
/// </returns>
function OffsetRange(const CellRange: TXlsCellRange; const DeltaRow, DeltaCol: integer): TXlsCellRange;
//Returns "A" for column 1, "B" for 2 and so on
/// <summary>
/// \Returns a column identifier for a column index.
/// </summary>
/// <remarks>
/// This method will return "A" for column 1, "B" for column 2, and "IV"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -