View Issue Details

IDProjectCategoryView StatusLast Update
0033241FPCPackagespublic2018-02-27 18:55
ReporterStephanoAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionProduct Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033241: FPReport designer: HTML links just affect the text color
DescriptionUsing HTML <a> tags in memo will not create a link in particular when the report is exported to html.
This feature is very important for drill-down reports where one can click on a number or label to get deeper into the report details.

The attached patch, although preliminary, creates the links. But moDisableWordWrap should be ON as fpreport breaks the link to different lines in order to accommodate the memo width, while the parser parses each line separately.
TagsNo tags attached.
Fixed in Revision38359
FPCOldBugId
FPCTarget
Attached Files
  • fpreport-HTMLlink-patch.diff (1,033 bytes)
    --- /home/me/fpc/packages/fcl-report/src/fpreporthtmlexport.pp
    +++ /home/me/fpc/fpreport-test/fpreporthtmlexport.pp
    @@ -1069,6 +1069,7 @@
       BS,S,aFamily,aStyle,aWeight : String;
       bDiv,span : THTMLElement;
       FixedPos : Boolean;
    +  L : THTMLLinkElement;
     
     begin
       lMemo := TFPReportMemo(AMemo);
    @@ -1143,9 +1144,19 @@
             S:=S+Format(' font-family: "%s";',[txtblk.FontName]);
           S:=S+ColorToStyle('color',TxtBlk.FGColor);
           ApplyStyle(bDiv,S);
    -      span:=FDoc.CreateSpanElement;
    -      span.appendChild(FDoc.CreateTextNode(txtBlk.Text));
    -      bDiv.AppendChild(span);
    +      if txtBlk is TFPHTTPTextBlock then
    +        begin
    +        L:=FDoc.CreateLinkElement;
    +        L.HRef:=TFPHTTPTextBlock(txtBlk).URL;
    +        L.AppendChild(FDoc.CreateTextNode(txtBlk.Text));
    +        bDiv.AppendChild(L);
    +        end
    +      else
    +        begin
    +        span:=FDoc.CreateSpanElement;
    +        span.appendChild(FDoc.CreateTextNode(txtBlk.Text));
    +        bDiv.AppendChild(span);
    +        end;
           end;
         end;
     end;
    
    

Activities

Stephano

2018-02-26 20:00

developer  

fpreport-HTMLlink-patch.diff (1,033 bytes)
--- /home/me/fpc/packages/fcl-report/src/fpreporthtmlexport.pp
+++ /home/me/fpc/fpreport-test/fpreporthtmlexport.pp
@@ -1069,6 +1069,7 @@
   BS,S,aFamily,aStyle,aWeight : String;
   bDiv,span : THTMLElement;
   FixedPos : Boolean;
+  L : THTMLLinkElement;
 
 begin
   lMemo := TFPReportMemo(AMemo);
@@ -1143,9 +1144,19 @@
         S:=S+Format(' font-family: "%s";',[txtblk.FontName]);
       S:=S+ColorToStyle('color',TxtBlk.FGColor);
       ApplyStyle(bDiv,S);
-      span:=FDoc.CreateSpanElement;
-      span.appendChild(FDoc.CreateTextNode(txtBlk.Text));
-      bDiv.AppendChild(span);
+      if txtBlk is TFPHTTPTextBlock then
+        begin
+        L:=FDoc.CreateLinkElement;
+        L.HRef:=TFPHTTPTextBlock(txtBlk).URL;
+        L.AppendChild(FDoc.CreateTextNode(txtBlk.Text));
+        bDiv.AppendChild(L);
+        end
+      else
+        begin
+        span:=FDoc.CreateSpanElement;
+        span.appendChild(FDoc.CreateTextNode(txtBlk.Text));
+        bDiv.AppendChild(span);
+        end;
       end;
     end;
 end;

Michael Van Canneyt

2018-02-27 13:16

administrator   ~0106667

This was still on my todo list. Applied the patch, thank you very much !

Issue History

Date Modified Username Field Change
2018-02-26 20:00 Stephano New Issue
2018-02-26 20:00 Stephano File Added: fpreport-HTMLlink-patch.diff
2018-02-26 20:04 Stephano Description Updated View Revisions
2018-02-27 11:25 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-02-27 11:25 Michael Van Canneyt Status new => assigned
2018-02-27 13:15 Michael Van Canneyt Project Lazarus => FPC
2018-02-27 13:16 Michael Van Canneyt Product Version 1.9 (SVN) =>
2018-02-27 13:16 Michael Van Canneyt Fixed in Revision => 38359
2018-02-27 13:16 Michael Van Canneyt Note Added: 0106667
2018-02-27 13:16 Michael Van Canneyt Status assigned => resolved
2018-02-27 13:16 Michael Van Canneyt Fixed in Version => 3.1.1
2018-02-27 13:16 Michael Van Canneyt Resolution open => fixed
2018-02-27 13:16 Michael Van Canneyt Target Version => 3.2.0
2018-02-27 18:55 Stephano Status resolved => closed