瀏覽代碼

* Implement option to replace too-long words with asterisks (bug ID 33639)

git-svn-id: trunk@43491 -
michael 5 年之前
父節點
當前提交
e959e6165e
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      packages/fcl-report/src/fpreport.pp

+ 11 - 1
packages/fcl-report/src/fpreport.pp

@@ -143,7 +143,11 @@ type
             moResetAggregateOnColumn
             moResetAggregateOnColumn
             );
             );
   TFPReportMemoOptions    = set of TFPReportMemoOption;
   TFPReportMemoOptions    = set of TFPReportMemoOption;
-  TFPReportWordOverflow = (woTruncate,woOverflow,woSplit);
+  TFPReportWordOverflow = (woTruncate, // truncate the word
+                           woOverflow, // Allow to overflow
+                           woSplit,    // Split word at max char count that fits length.
+                           woAsterisk  // Replace word with * chars.
+                           );
 
 
   TFPReportSections    = set of rsPage..rsColumn;
   TFPReportSections    = set of rsPage..rsColumn;
 
 
@@ -3974,6 +3978,12 @@ begin
             m:=Length(S); // Discard the remainder of the word.
             m:=Length(S); // Discard the remainder of the word.
           woSplit:
           woSplit:
             m:=Length(S3); // S3 was the longest possible part of the word. Split after
             m:=Length(S3); // S3 was the longest possible part of the word. Split after
+          woAsterisk:
+            begin
+            w:= lFC.TextWidth('*', Font.Size);
+            S2:=StringOfChar('*',round(MaxW / w));
+            m:=Length(S); // Discard the remainder of the word.
+            end;
        end;
        end;
        end;
        end;
       FTextLines.Add(s2);
       FTextLines.Add(s2);