You've already forked lazarus-ccr
fpspreadsheet: Store whether a cell is not allowed for printing (UsedFormattingFields flag uffDoNotPrint). Implemented for ODS only.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8921 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -273,6 +273,7 @@ type
|
||||
function WriteHorAlignmentStyleXMLAsString(const AFormat: TsCellFormat): String;
|
||||
function WriteNumFormatStyleXMLAsString(const AFormat: TsCellFormat): String;
|
||||
function WritePageLayoutXMLAsString(AStyleName: String; const APageLayout: TsPageLayout): String;
|
||||
function WritePrintContentStyleXMLAsString(const AFormat: TsCellFormat): String;
|
||||
function WritePrintRangesXMLAsString(ASheet: TsBasicWorksheet): String;
|
||||
function WriteSheetProtectionXMLAsString(ASheet: TsBasicWorksheet): String;
|
||||
function WriteSheetProtectionDetailsXMLAsString(ASheet: TsBasicWorksheet): String;
|
||||
@ -5349,6 +5350,11 @@ begin
|
||||
// formulas...
|
||||
if AFormat.Protection <> DEFAULT_CELL_PROTECTION then
|
||||
Include(AFormat.UsedFormattingFields, uffProtection);
|
||||
|
||||
// Disable cell printing
|
||||
s := GetAttrValue(ANode, 'style:print-content');
|
||||
if s = 'false' then
|
||||
Include(AFormat.UsedFormattingFields, uffDoNotPrint);
|
||||
end;
|
||||
|
||||
procedure TsSpreadOpenDocReader.ReadStyle_TextProperties(ANode: TDOMNode;
|
||||
@ -6348,7 +6354,8 @@ begin
|
||||
WriteBackgroundColorStyleXMLAsString(AFormat) +
|
||||
WriteWordwrapStyleXMLAsString(AFormat) +
|
||||
WriteTextRotationStyleXMLAsString(AFormat) +
|
||||
WriteVertAlignmentStyleXMLAsString(AFormat);
|
||||
WriteVertAlignmentStyleXMLAsString(AFormat) +
|
||||
WritePrintContentStyleXMLAsString(AFormat);
|
||||
if addProtection then
|
||||
s := s + WriteCellProtectionStyleXMLAsString(AFormat);
|
||||
if s <> '' then
|
||||
@ -7323,6 +7330,15 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
function TsSpreadOpenDocWriter.WritePrintContentStyleXMLAsString(
|
||||
const AFormat: TsCellFormat): String;
|
||||
begin
|
||||
if (uffDoNotPrint in AFormat.UsedFormattingFields) then
|
||||
Result := 'style:print-content="false"'
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure TsSpreadOpenDocWriter.WriteRowsAndCells(AStream: TStream;
|
||||
ASheet: TsBasicWorksheet);
|
||||
var
|
||||
|
@ -188,6 +188,7 @@ type
|
||||
function ReadWordwrap(ACell: PCell): boolean;
|
||||
function ReadBiDiMode(ACell: PCell): TsBiDiMode;
|
||||
function ReadCellProtection(ACell: PCell): TsCellProtections;
|
||||
function ReadDoNotPrintCell(ACell: PCell): Boolean;
|
||||
|
||||
function IsEmpty: Boolean;
|
||||
|
||||
@ -379,6 +380,9 @@ type
|
||||
procedure WriteCellProtection(ACell: PCell;
|
||||
AValue: TsCellProtections); overload;
|
||||
|
||||
function WriteDoNotPrintCell(ARow, ACol: Cardinal; AValue: boolean): PCell; overload;
|
||||
procedure WriteDoNotPrintCell(ACell: PCell; AValue: Boolean); overload;
|
||||
|
||||
{ Conditional formatting }
|
||||
|
||||
// cell-related comparisons
|
||||
|
@ -194,6 +194,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Returns whether the cell is not allowed to be printed.
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.ReadDoNotPrintCell(ACell: PCell): Boolean;
|
||||
var
|
||||
fmt: PsCellFormat;
|
||||
begin
|
||||
Result := false;
|
||||
if ACell <> nil then
|
||||
begin
|
||||
fmt := Workbook.GetPointerToCellFormat(ACell^.FormatIndex);
|
||||
Result := uffDoNotPrint in fmt.UsedFormattingFields;
|
||||
end;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Returns the horizontal alignment of a specific cell
|
||||
@ -720,6 +734,28 @@ begin
|
||||
ChangedCell(ACell^.Row, ACell^.Col);
|
||||
end;
|
||||
|
||||
function TsWorksheet.WriteDoNotPrintCell(ARow, ACol: Cardinal;
|
||||
AValue: boolean): PCell;
|
||||
begin
|
||||
Result := GetCell(ARow, ACol);
|
||||
WriteDoNotPrintCell(Result, AValue);
|
||||
end;
|
||||
|
||||
procedure TsWorksheet.WriteDoNotPrintCell(ACell: PCell; AValue: Boolean);
|
||||
var
|
||||
fmt: TsCellFormat;
|
||||
begin
|
||||
if ACell = nil then
|
||||
exit;
|
||||
fmt := Workbook.GetCellFormat(ACell^.FormatIndex);
|
||||
if AValue then
|
||||
Include(fmt.UsedFormattingfields, uffDoNotPrint)
|
||||
else
|
||||
Exclude(fmt.UsedFormattingFields, uffDoNotPrint);
|
||||
ACell^.FormatIndex := Workbook.AddCellFormat(fmt);
|
||||
ChangedCell(ACell^.Row, ACell^.Col);
|
||||
end;
|
||||
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Defines the horizontal alignment of text in a cell.
|
||||
|
@ -421,10 +421,11 @@ type
|
||||
@value uffHorAlign The cell format supports horizontal text alignment.
|
||||
@value uffVertAlign The cell format supports vertical text alignment
|
||||
@value uffBiDi The cell format supports right-to-left text display.
|
||||
@value uffProtection The cell format supports locking of cells. }
|
||||
@value uffProtection The cell format supports locking of cells.
|
||||
@value uffDoNotPrint The cell is not printed. }
|
||||
TsUsedFormattingField = (uffTextRotation, uffFont, uffBorder, uffBackground,
|
||||
uffNumberFormat, uffWordWrap, uffHorAlign, uffVertAlign, uffBiDi,
|
||||
uffProtection
|
||||
uffProtection, uffDoNotPrint
|
||||
);
|
||||
{ NOTE: "uffBackgroundColor" of older versions replaced by "uffBackground" }
|
||||
|
||||
|
Reference in New Issue
Block a user