📄 tmsuxlsbaserecords.pas
字号:
function TSubListRecord.TotalSize: integer;
begin
Result:=0;
end;
{ TDimensionsRecord }
function TDimensionsRecord.Dim: PDimensionsRec;
begin
Result:=PDimensionsRec(Data);
end;
{ TPageHeaderFooterRecord }
function TPageHeaderFooterRecord.GetText: UTF16String;
var
Xs: TExcelString;
MySelf: TBaseRecord;
Ofs: integer;
begin
if Data=nil then
begin
Result:='';
exit;
end;
MySelf:=Self;
Ofs:= 0;
Xs:=TExcelString.Create(2, MySelf, Ofs );
try
Result:=Xs.Value;
finally
FreeAndNil(Xs);
end; //finally
end;
procedure TPageHeaderFooterRecord.SetText(const Value: UTF16String);
//Important: This method changes the size of the record without notifying it's parent list
//It's necessary to adapt the Totalsize in the parent list.
var
Xs: TExcelString;
NewDataSize: integer;
begin
Xs:=TExcelString.Create(2, Value);
try
NewDataSize:=Xs.TotalSize;
ReallocMem(Data, NewDataSize);
DataSize:=NewDataSize;
Xs.CopyToPtr( Data, 0 );
finally
FreeAndNil(Xs);
end; //finally
end;
{ TPrintGridLinesRecord }
function TPrintGridLinesRecord.GetValue: boolean;
begin
Result:=GetWord(Data,0)=1;
end;
procedure TPrintGridLinesRecord.SetValue(const Value: boolean);
begin
if Value then SetWord(Data,0,1) else SetWord(Data,0,0)
end;
{ TMarginRecord }
function TMarginRecord.GetValue: double;
begin
move(Data[0], Result, SizeOf(Result));
end;
procedure TMarginRecord.SetValue(const Value: double);
begin
Assert(SizeOf(Value)=DataSize,'Error in Margin Record');
move(Value,Data[0],sizeof(Value));
end;
{ TSetupRecord }
function TSetupRecord.GetFitHeight: word;
begin
Result:=PSetupRec(Data).FitHeight;
end;
function TSetupRecord.GetFitWidth: word;
begin
Result:=PSetupRec(Data).FitWidth;
end;
function TSetupRecord.GetFooterMargin: extended;
begin
Result:=PSetupRec(Data).FooterMargin;
end;
function TSetupRecord.GetHeaderMargin: extended;
begin
Result:=PSetupRec(Data).HeaderMargin;
end;
function TSetupRecord.GetPrintCopies: integer;
begin
if PrintOptions and $04 = $04 then Result:=1
else
Result:=PSetupRec(Data).Copies;
end;
function TSetupRecord.GetPrintOptions: word;
begin
Result:=PSetupRec(Data).GrBit;
end;
function TSetupRecord.GetPrintPaperSize: TExcelPaperSize;
begin
if PrintOptions and $04 = $04 then Result:=0
else
Result:=PSetupRec(Data).PaperSize;
end;
function TSetupRecord.GetPrintXResolution: integer;
begin
if PrintOptions and $04 = $04 then Result:=100
else
Result:=PSetupRec(Data).Resolution;
end;
function TSetupRecord.GetPrintYResolution: integer;
begin
if PrintOptions and $04 = $04 then Result:=100
else
Result:=PSetupRec(Data).VResolution;
end;
function TSetupRecord.GetScale: word;
begin
if (PSetupRec(Data).GrBit and $4)=$4 then Result:=100 else
Result:=PSetupRec(Data).Scale;
end;
function TSetupRecord.GetValue: TSetupRec;
begin
move(Data[0], Result, SizeOf(Result));
end;
procedure TSetupRecord.SetFitHeight(const Value: word);
begin
PSetupRec(Data).FitHeight:=Value;
end;
procedure TSetupRecord.SetFitWidth(const Value: word);
begin
PSetupRec(Data).FitWidth:=Value;
end;
procedure TSetupRecord.SetFooterMargin(const Value: extended);
begin
PSetupRec(Data).FooterMargin:=Value;
end;
procedure TSetupRecord.SetHeaderMargin(const Value: extended);
begin
PSetupRec(Data).HeaderMargin:=Value;
end;
procedure TSetupRecord.SetPrintCopies(const Value: integer);
begin
PrintOptions:= PrintOptions and not Word($04);
PSetupRec(Data).Copies:=Value;
end;
procedure TSetupRecord.SetPrintOptions(const Value: word);
begin
PSetupRec(Data).GrBit:=Value and $FF;
end;
procedure TSetupRecord.SetPrintPaperSize(const Value: TExcelPaperSize);
begin
PrintOptions:= PrintOptions and not Word($04);
PSetupRec(Data).PaperSize:=Value;
end;
procedure TSetupRecord.SetPrintXResolution(const Value: integer);
begin
PrintOptions:= PrintOptions and not Word($04);
PSetupRec(Data).Resolution:=Value;
end;
procedure TSetupRecord.SetPrintYResolution(const Value: integer);
begin
PrintOptions:= PrintOptions and not Word($04);
PSetupRec(Data).VResolution:=Value;
end;
procedure TSetupRecord.SetScale(const Value: word);
begin
PSetupRec(Data).GrBit:=PSetupRec(Data).GrBit or $4;
PSetupRec(Data).Scale:=Value;
end;
procedure TSetupRecord.SetValue(const Value: TSetupRec);
begin
Assert(SizeOf(Value)=DataSize,'Error in Setup Record');
move(Value, Data[0], SizeOf(Value));
end;
{ TWsBoolRecord }
function TWsBoolRecord.GetFitToPage: boolean;
begin
Result:= Data[1] and 1=1;
end;
function TWsBoolRecord.GetOutlineSummaryColsRightOfDetail: boolean;
begin
Result:= Data[0] and $80 <> 0;
end;
function TWsBoolRecord.GetOutlineSummaryRowsBelowDetail: boolean;
begin
Result:= Data[0] and $40 <> 0;
end;
function TWsBoolRecord.GetOutlineAutomaticStyles: boolean;
begin
Result:= Data[0] and $20 <> 0;
end;
function TWsBoolRecord.GetValue: word;
begin
Result:=GetWord(Data,0);
end;
procedure TWsBoolRecord.SetFitToPage(const Value: boolean);
begin
if Value then Data[1]:=Data[1] or 1 else Data[1]:=Data[1] and $FF-1;
end;
procedure TWsBoolRecord.SetOutlineRightOfDetail(const Value: boolean);
begin
if Value then Data[0]:=Data[0] or $80 else Data[0]:=Data[0] and not $80;
end;
procedure TWsBoolRecord.SetOutlineSummaryRowsBelowDetail(const Value: boolean);
begin
if Value then Data[0]:=Data[0] or $40 else Data[0]:=Data[0] and not $40;
end;
procedure TWsBoolRecord.SetOutlineAutomaticStyles(const Value: boolean);
begin
if Value then Data[0]:=Data[0] or $20 else Data[0]:=Data[0] and not $20;
end;
procedure TWsBoolRecord.SetValue(const Value: word);
begin
SetWord(Data, 0, Value);
end;
{ TSCLRecord }
constructor TSCLRecord.CreateFromData(const aZoom: integer);
var
aData:pointer;
begin
GetMem(aData, 4);
Create(xlr_SCL, aData, 4);
SetZoom(aZoom);
end;
function TSCLRecord.GetZoom: integer;
begin
if GetWord(Data,2)= 0 then Result:=100 else
Result:=Round(100*GetWord(Data,0)/GetWord(Data,2));
end;
procedure TSCLRecord.SetZoom(const Value: integer);
var
v: integer;
begin
if Value<10 then v:=10 else if Value>400 then v:=400 else v:=Value;
SetWord(Data,0,v);
SetWord(Data,2,100);
end;
{ TStandardWidthRecord }
function TStandardWidthRecord.Width: Word;
begin
Result:= GetWord(Data, 0);
end;
{ TRefModeRecord }
function TRefModeRecord.GetIsR1C1: boolean;
begin
Result:=GetWord(Data,0)<>1;
end;
procedure TRefModeRecord.SetIsR1C1(const Value: boolean);
begin
if Value then SetWord(Data, 0, 0) else SetWord(Data, 0, 1);
end;
{ T1904Record }
function T1904Record.GetIs1904: boolean;
begin
Result:=GetWord(Data,0)=1;
end;
procedure T1904Record.SetIs1904(const Value: boolean);
begin
if Value then SetWord(Data, 0, 1) else SetWord(Data, 0, 0);
end;
{ TPrecisionRecord }
function TPrecisionRecord.GetPrecisionAsDisplayed: boolean;
begin
Result:=GetWord(Data,0)=0;
end;
procedure TPrecisionRecord.SetPrecisionAsDisplayed(const Value: boolean);
begin
if Value then SetWord(Data, 0, 0) else SetWord(Data, 0, 1);
end;
{ TBookBoolRecord }
function TBookBoolRecord.GetSaveExternalLinkValues: boolean;
begin
Result:=GetWord(Data,0)<>1;
end;
procedure TBookBoolRecord.SetSaveExternalLinkValues(const Value: boolean);
begin
if Value then SetWord(Data, 0, 0) else SetWord(Data, 0, 1);
end;
{ TPlsRecord }
constructor TPlsRecord.CreateFromData(
aPrinterData: TPrinterDriverSettings);
var
aData:pointer;
begin
GetMem(aData, SizeOf(aPrinterData.OperatingEnviroment)+Length(aPrinterData.Data));
Create(xlr_PLS, aData, SizeOf(aPrinterData.OperatingEnviroment)+Length(aPrinterData.Data));
SetPrinterDriverSettings(aPrinterData);
end;
function TPlsRecord.GetPrinterDriverSettings: TPrinterDriverSettings;
begin
Result.OperatingEnviroment:= GetWord(Data,0);
SetLength(Result.Data, DataSize-2);
move (Data[2], Result.Data[0], Length(Result.Data));
end;
procedure TPlsRecord.SetPrinterDriverSettings(
const Value: TPrinterDriverSettings);
var
NewDataSize: integer;
begin
NewDataSize:=SizeOf(Value.OperatingEnviroment)+Length(Value.Data);
if DataSize <> NewDataSize then
begin
FreeAndNil(Data);
GetMem(Data, NewDataSize);
end;
SetWord(Data,0, Value.OperatingEnviroment);
move(Value.Data[0], Data[2], DataSize-2);
end;
{ TAutoFilterInfoRecord }
function TAutoFilterInfoRecord.Get_DropDownCount(): Int32;
begin
Result := GetWord(Data, 0);
end;
procedure TAutoFilterInfoRecord.Set_DropDownCount(const value: Int32);
begin
SetWord(Data, 0, value);
end;
{ TPrintCenteredRecord }
function TPrintCenteredRecord.GetCentered: boolean;
begin
Result := GetWord(Data, 0) = 1;
end;
procedure TPrintCenteredRecord.SetCentered(const Value: boolean);
begin
if Value then SetWord(Data, 0, 1) else SetWord(Data, 0, 0);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -