📄 uxlssheet.pas
字号:
var
OldSize: integer;
begin
if P=nil then exit;
OldSize:=P.DataSize;
P.Text:=s;
FMiscRecords1.AdaptSize(P.DataSize-OldSize);
end;
function TWorkSheet.HasHPageBreak(const Row: integer): boolean;
begin
Result:=FHPageBreaks.HasPageBreak(Row);
end;
function TWorkSheet.HasVPageBreak(const Col: integer): boolean;
begin
Result:=FVPageBreaks.HasPageBreak(Col);
end;
function TWorkSheet.GetPrintNumberOfHorizontalPages: word;
begin
if FSetup= nil then Result:=1 else
Result:= FSetup.FitWidth;
end;
function TWorkSheet.GetPrintNumberOfVerticalPages: word;
begin
if FSetup= nil then Result:=1 else
Result:= FSetup.FitHeight;
end;
function TWorkSheet.GetPrintScale: integer;
begin
if FSetup= nil then Result:=100 else
Result:= FSetup.Scale;
end;
function TWorkSheet.GetPrintToFit: boolean;
begin
if FWsBool= nil then Result:=false else
Result:= FWsBool.FitToPage;
end;
function TWorkSheet.GetOutlineSummaryRowsBelowDetail: boolean;
begin
if FWsBool= nil then Result:=true else
Result:= FWsBool.OutlineSummaryRowsBelowDetail;
end;
function TWorkSheet.GetOutlineSummaryColsRightOfDetail: boolean;
begin
if FWsBool= nil then Result:=true else
Result:= FWsBool.OutlineSummaryColsRightOfDetail;
end;
function TWorkSheet.GetOutlineAutomaticStyles: boolean;
begin
if FWsBool= nil then Result:=false else
Result:= FWsBool.OutlineAutomaticStyles;
end;
procedure TWorkSheet.SetPrintNumberOfHorizontalPages(const Value: word);
begin
if FSetup<>nil then FSetup.FitWidth:=Value;
end;
procedure TWorkSheet.SetPrintNumberOfVerticalPages(const Value: word);
begin
if FSetup<>nil then FSetup.FitHeight:=Value;
end;
procedure TWorkSheet.SetPrintScale(const Value: integer);
begin
if (Value<Low(Word))or (Value>High(Word)) then
raise Exception.CreateFmt(ErrXlsIndexOutBounds, [Value, 'PrintScale', Low(Word), High(Word)]);
if FSetup<>nil then FSetup.Scale:=Value;
end;
procedure TWorkSheet.SetPrintToFit(const Value: boolean);
begin
if FWSBool<>nil then FWsBool.FitToPage:=value;
end;
procedure TWorkSheet.SetOutlineSummaryRowsBelowDetail(const value: boolean);
begin
if FWsBool <> nil then FWsBool.OutlineSummaryRowsBelowDetail:=value;
end;
procedure TWorkSheet.SetOutlineSummaryColsRightOfDetail(const value: boolean);
begin
if FWsBool <> nil then FWsBool.OutlineSummaryColsRightOfDetail:=value;
end;
procedure TWorkSheet.SetOutlineAutomaticStyles(const value: boolean);
begin
if FWsBool <> nil then FWsBool.OutlineAutomaticStyles:=value;
end;
procedure TWorkSheet.AddImage(const Data: string; const DataType: TXlsImgTypes; const Properties: TImageProperties;const Anchor: TFlxAnchorType);
begin
FDrawing.AddImage(Data, DataType, Properties, Anchor, self);
end;
procedure TWorkSheet.ClearImage(const Index: integer);
begin
FDrawing.ClearImage(Index);
end;
procedure TWorkSheet.DeleteImage(const Index: integer);
begin
FDrawing.DeleteImage(Index);
end;
procedure TWorkSheet.AddZoomRecord;
begin
if FMiscRecords2.Count>1 then
begin
FMiscRecords2.Insert(1,TSCLRecord.CreateFromData(100));
FZoom:=FMiscRecords2[1] as TSCLRecord;
end;
end;
procedure TWorkSheet.AddNewComment(const Row, Col: integer;
const Txt: widestring; const Properties: TImageProperties);
begin
FNotes.AddNewComment(Row, Col, Txt, FDrawing, Properties, self);
end;
procedure TWorkSheet.ClearValues;
begin
Clear;
DoCreateFromData(FWorkbookGlobals.SST);
end;
function TWorkSheet.GetPrintOptions: word;
begin
if FSetup= nil then Result:=0 else
Result:= FSetup.PrintOptions;
end;
procedure TWorkSheet.SetPrintOptions(const Value: word);
begin
if FSetup<>nil then FSetup.PrintOptions:=Value;
end;
procedure TWorkSheet.FixCachePointers;
var
i: integer;
begin
inherited;
for i:=0 to FMiscRecords1.Count-1 do
LoadCachePointers(FMiscRecords1[i] as TBaseRecord);
for i:=0 to FMiscRecords2.Count-1 do
LoadCachePointers(FMiscRecords2[i] as TBaseRecord);
end;
function TWorkSheet.GetColOutlineLevel(col: integer): integer;
var
Index: integer;
begin
if not FColumns.Find(col, Index) then
Result:= 0
else
Result:= FColumns[Index].GetColOutlineLevel;
end;
function TWorkSheet.GetRowOutlineLevel(row: integer): integer;
begin
if not FCells.RowList.HasRow(row) then
Result:=0
else
Result:= FCells.RowList[row].Options and $07;
end;
procedure TWorkSheet.SetColOulineLevel(col: integer; const Value: integer);
var
Index: integer;
begin
EnsureGuts();
FGuts.RecalcNeeded:=true;
Index:=-1;
if (not FColumns.Find(col, Index)) then
FColumns.Insert(Index, TColInfo.Create(col, DefColWidth, 15, 0));
FColumns[Index].SetColOutlineLevel(Value);
end;
procedure TWorkSheet.SetRowOulineLevel(row: integer; const Value: integer);
begin
EnsureGuts();
FGuts.RecalcNeeded:=true;
FCells.RowList.AddRow(row);
FCells.RowList[row].SetRowOutlineLevel(Value);
end;
procedure TWorkSheet.EnsureGuts;
var
aPos: integer;
i: integer;
pdata: PArrayOfByte;
begin
if (FGuts<>nil) then exit;
aPos:=FMiscRecords1.Count;
for i:=0 to FMiscRecords1.Count do
begin
if (FMiscRecords1[i] is TDefRowHeightRecord) then
begin
aPos:=i;
break;
end;
end;
GetMem(pdata, 0);
FillChar(pdata^,8,0);
FGuts:= TGutsRecord.Create(xlr_GUTS, pdata, 8);
FMiscRecords1.Insert(aPos, FGuts);
end;
function TWorkSheet.GetPrintCopies: integer;
begin
if FSetup= nil then Result:=1 else
Result:= FSetup.PrintCopies;
end;
function TWorkSheet.GetPrinterDriverSettings: TPrinterDriverSettings;
begin
if FPrinterDriverSettings = nil then
begin
Result.OperatingEnviroment:=0;
SetLength(Result.Data, 0);
exit;
end;
Result:=FPrinterDriverSettings.PrinterData;
end;
function TWorkSheet.GetPrintPaperSize: TExcelPaperSize;
begin
if FSetup= nil then Result:=1 else
Result:= FSetup.PrintPaperSize;
end;
function TWorkSheet.GetPrintXResolution: integer;
begin
if FSetup= nil then Result:=600 else
Result:= FSetup.PrintXResolution;
end;
function TWorkSheet.GetPrintYResolution: integer;
begin
if FSetup= nil then Result:=600 else
Result:= FSetup.PrintXResolution;
end;
procedure TWorkSheet.SetPrintCopies(const Value: integer);
begin
if (Value<0) or (Value>$FFFF) then raise Exception.CreateFmt(ErrIndexOutBounds,[Value,'PrintCopies',0,$FFFF]);
if FSetup<>nil then FSetup.PrintCopies:=Value;
end;
procedure TWorksheet.AddPrinterDriverRecord(const aPlsRecord:TPlsRecord; const FRecords: TBaseRecordList);
var
idx,i: integer;
begin
if FPrinterDriverSettings<>nil then RemovePrinterDriverRecord;
idx:=FRecords.Count;
if FSetup<>nil then
for i:=0 to FRecords.Count-1 do
if (FRecords[i]=FSetup) then
begin
idx:=i;
break;
end;
FRecords.Insert(idx, aPlsRecord);
FPrinterDriverSettings:=aPlsRecord;
end;
procedure TWorksheet.RemovePrinterDriverRecord;
begin
RemovePrinterDriverRecord(FMiscRecords1);
RemovePrinterDriverRecord(FMiscRecords1);
end;
procedure TWorksheet.RemovePrinterDriverRecord(const FRecords: TBaseRecordList);
var
i: integer;
begin
for i:=FRecords.Count-1 downto 0 do
if FRecords[i] is TPlsRecord then
FRecords.Delete(i);
end;
procedure TWorkSheet.SetPrinterDriverSettings(
const Value: TPrinterDriverSettings);
begin
if Length(value.Data) = 0 then
RemovePrinterDriverRecord
else
begin
AddPrinterDriverRecord(TPlsRecord.CreateFromData(Value), FMiscRecords1);
PrintOptions:=PrintOptions and not word($4);
//Not needed. If you want to copy the PaperSize, just use PaperSize property.
//PaperSize=(TPaperSize)BitOps.GetWord(aData, 80);
end;
end;
procedure TWorkSheet.SetPrintPaperSize(const Value: TExcelPaperSize);
begin
if (Value<0) or (Value>$FFFF) then raise Exception.CreateFmt(ErrIndexOutBounds,[Value,'PrintPaperSize',0,$FFFF]);
if FSetup<>nil then FSetup.PrintPaperSize:=Value;
end;
procedure TWorkSheet.SetPrintXResolution(const Value: integer);
begin
if (Value<0) or (Value>$FFFF) then raise Exception.CreateFmt(ErrIndexOutBounds,[Value,'PrintXResolution',0,$FFFF]);
if FSetup<>nil then FSetup.PrintXResolution:=Value;
end;
procedure TWorkSheet.SetPrintYResolution(const Value: integer);
begin
if (Value<0) or (Value>$FFFF) then raise Exception.CreateFmt(ErrIndexOutBounds,[Value,'PrintYResolution',0,$FFFF]);
if FSetup<>nil then FSetup.PrintYResolution:=Value;
end;
procedure TWorkSheet.RestoreObjectCoords;
begin
FDrawing.RestoreObjectCoords(Self);
end;
procedure TWorkSheet.RecalcRowHeights(const Workbook: pointer; const Row1, Row2: Integer; const Forced: Boolean; const KeepAutoFit: Boolean; const Adjustment: extended);
begin
Cells.CellList.RecalcRowHeights(Workbook, Row1, Row2, Forced, KeepAutoFit, Adjustment);
end;
procedure TWorkSheet.RecalcColWidths(const Workbook: pointer; const Col1, Col2: Integer; const IgnoreStrings: Boolean; const Adjustment: extended);
begin
Cells.CellList.RecalcColWidths(Workbook, Col1, Col2, IgnoreStrings, Adjustment);
end;
{ TFlxUnsupportedSheet }
procedure TFlxUnsupportedSheet.ArrangeCopySheet(const SheetInfo: TSheetInfo);
begin
end;
procedure TFlxUnsupportedSheet.InsertAndCopyRowsAndCols(const FirstRow, LastRow, DestRow, aRowCount,FirstCol, LastCol, DestCol, aColCount: integer; const SheetInfo: TSheetInfo; const OnlyFormulas: boolean);
begin
end;
procedure TFlxUnsupportedSheet.DeleteRowsAndCols(const aRow, aRowCount, aCol, aColCount: word; const SheetInfo: TSheetInfo);
begin
end;
procedure TFlxUnsupportedSheet.Clear;
begin
inherited;
//Dont Clear FCodeName
if FSheetRecords<>nil then FSheetRecords.Clear;
end;
function TFlxUnsupportedSheet.DoCopyTo: TSheet;
begin
Result:= inherited DoCopyTo;
(Result as TFlxUnsupportedSheet).FSheetRecords.CopyFrom(FSheetRecords);
Result.FixCachePointers;
end;
constructor TFlxUnsupportedSheet.Create(const aWorkbookGlobals: TWorkbookGlobals);
begin
inherited;
FSheetRecords:= TSheetRecordList.Create;
FPrintRecords:=FSheetRecords;
end;
destructor TFlxUnsupportedSheet.Destroy;
begin
FreeAndNil(FSheetRecords);
FreeAndNil(FCodeName);
inherited;
end;
procedure TFlxUnsupportedSheet.LoadFromStream(const DataStream: TStream;
const First: TBOFRecord; con
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -