Is there a simple example somewhere that shows how the -csspath parameter is supposed to be used?
Beiträge von mgkrebbs
-
-
It was noted in changes for 5.22 that there is an option to specify a style sheet.
"-csspath:"..." can be used to specify a CSS style for loading and saving"
I couldn't find an example of where this is done and what we should pass to it.
Here is what I tried:
FPaintEngine.Memo.TextLoadFormat:=FPaintEngine.Memo.TextLoadFormat+' -csspath:"\ReportStyleSheets\ReportStyles.css"';
Do I need to send the full path, or will a relative path do?
Do I need to add a link to it in a header in the html, or not?
Thanks!
-
Errors compiling WPTools 9 in Delphi7:
Code[Hint] WPRTEPaint.pas(13122): Value assigned to 'dblbuffer' never used [Hint] WPObj_IMAGE.pas(1690): Variable 'ameta' is declared but never used in 'TWPOCustomImage.Paint' [Hint] WPObj_IMAGE.pas(1691): Variable 'ametacan' is declared but never used in 'TWPOCustomImage.Paint' [Warning] WPIO.pas(50): *** (Info) Reader and writer classes have been included using unit "WPIO" [Hint] WPRTEFormatBase.pas(204): Value assigned to 'tw' never used [Error] WPCTRMemo.pas(11586): Undeclared identifier: 'ssTouch' [Error] WPCTRMemo.pas(12158): Undeclared identifier: 'ssTouch' [Error] WPCTRMemo.pas(12452): Undeclared identifier: 'ssTouch' [Fatal Error] WPUtil.pas(74): Could not compile used unit 'WPCTRMemo.pas'
the other references to "Touch" are inside {$IFDEF DELPHI_TOUCH} blocks.
Should these lines be inside similar switches, or at least {$IFDEF DELPHIXE} +?
I do have the {$DEFINE WPPDFEX} on in WPINC.INC , if it's related at all.
Thanks!
-
I see that mode mentioned and was commented out in 2 procedures in my ppWPTools unit.....
EDIT - I removed that code because as noted in the header of that file, this Sourcecode may not be published!
-
Julian,
Delphi 7 update 2
WP7Professional_v7.33.1
wPDF4_PRO_InternetLicense_v4.77.2 (have {.$DEFINE INTWPSWITCH} off as instructed, so dll is not needed)
ReportBuilder Enterprise Edition version 15.05 Build 275
I think since I updated to WPTools 7 / I've not been getting hyperlinks when exporting reports to pdf (with wpdf, of course). The hyperlinks ar the right color and undelined, but do nothing in the pdf.
I still have old exe's using WPTools 6 wpdf3, Report Builder 7.2, and the hyperlinks export just fine using those versions.
Is there some compiler switch I need to change, or something I've forgotten?
Thanks!
-
Julian,
I went with the wpview_pdfMakeImage function. Is there a good explanation of the "jpegres:Integer" parameter. I tried 100, thinking it was a percentage, and I had seen it in an example, but the image is about the same quality as before.
This in your Instruction pdf, but it's over my head:
Zitatjpegres: - low-word (0000XXXX): the resolution for the JPEG file (default = 72),
hi-word: various options:
The lower nibble of the higher word is used to select the color depth.
It may may have this values:
1 : 1 bit monochrome dithered
2 : 1 bit monochrome not dithered
3 : 8 bit color
4 : 8 bit gray
otherwise: 24 bit color
The high byte of the high word is used to select the JPEG compression level
Some example of low medium high would help me.
Thanks.
-
Julian,
I wrote a pass-through function in ReportBuilder to render each page of a PDF and display in a ppImage. However the resulting image seems to lose some quality compared to what your demo app does with the image. And this is the raw image saved to file (2nd to last line). Any tips on getting 100% image quality?
Thanks.
Code
Alles anzeigenlBitmap := TBitmap.Create; lBitmap.Width:=816;//408;//817; lBitmap.Height:=1056;//523;//1057; //lBitmap. lCanvas := lBitmap.Canvas; //How do I load the pdf from the stream? zTempfilename := ExtractFilePath(ParamStr(0))+'tempPDF.pdf'; zStream.SaveToFile(zTempfilename); wpview_pdfWorkbenchLoad(workbench, PWideChar(zTempfilename), 0, 0); wpview_pdfWorkbenchCommand( workbench, COMPDF_PrintHDCSetXRes, Floor(-lBitmap.Width), '', nil ); wpview_pdfWorkbenchCommand( workbench, COMPDF_PrintHDCSetYRes, Floor(-lBitmap.Height), '', nil ); wpview_pdfWorkbenchCommand( workbench, COMPDF_PrintHDC_SelectPage, lsPDFPageNo-1, '', nil );//Select the page wpview_pdfWorkbenchCommand( workbench, COMPDF_UseGDIPainter, -1, '', nil);//use GDI wpview_pdfWorkbenchCommand( workbench, COMPDF_PrintUseBitmaps, 1, '', nil);//2020-01-03 Dan. Improve quality? lCanvas.Lock; try wpview_pdfWorkbenchCommand( workbench, COMPDF_PrintHDC_SelectedPage, 0, '', Pointer( lCanvas.Handle )); finally lCanvas.UnLock; end; //For Debugging lBitmap.SaveToFile(ExtractFilePath(ParamStr(0))+'PDF_Page_'+IntToStr(lsPDFPageNo)+'_.emf'); lsImage.Picture.Bitmap.Assign(lBitmap);
-
Julian,
In trying to get RequestHTTPImage event to fire for a TppWPTRichText (ReportBuilder), I came across this post:
http://wpcubed.com/forum/viewtopi…t=createdynamic
and read that it had to do with CreateDynamic. I didn't understand this bit:Zitatthis event is actually triggered by the RTFDataCollection. You need to assign your handler there (w.RTFData) and not to the TWPRichText when you use a dynamically created editor control.
Julian
-so let me know the "proper" way to do this, but this is what I tried in my ppWPTools unit:Code//Result := TWPCustomRichTextForPP.CreateDynamic; Result := TWPCustomRichTextForPP.Create(nil);//2010-01-28 Dan //Result._MakeDynamic;//2010-01-28 Dan Result.InsertPointAttr.Hidden := TRUE;
It did succeed in causing the RequestHTTPImage to fire, and I followed it in the debugger as it successfully loaded the jpeg image into the TextObject, however the image still just appears as a red box.
Can you give me some guidance to help me get the image to appear?
Thanks.
D7
WPTools 5_39
WPTools RBSupport August 8, 2007 -
My apologies, I thought I had sent the test html already, because, I did, but it was in the 10/3 email about the superscript/subscript tags. Sorry about that :oops:
Here's the procedure, I added a part to add the -nospanobjects to the format. In the test project, I had to re-load it using stream to get the format to take effect (is there already a procedure to do this?), and it would not work unless the textloadformat is explicitly set to HTML to begin with (if 'AUTO' it wouldn't work), However in the ppWPTools unit, it does work, even when the format is 'AUTO'. Not sure why. I'm pasting the code, in case you have anny suggestions as far as improvements or best practices go:
Codeprocedure TppCustomWPTRichText.WPToolsForceFont(WPRichText : TWPCustomRTFEdit; Size : Single; fName : String);var i : Integer; ca : TWPCharAttr; par : TParagraph; sAddToFormat:String; zStream:TMemoryStream;begin sAddToFormat:=''; if (Pos('-nospanobjects',WPRichText.TextLoadFormat)=0) then begin//add this to the load format, if not already there, then reload if (Pos('-',WPRichText.TextLoadFormat)<>0) then sAddToFormat:=sAddToFormat+','; sAddToFormat:=sAddToFormat+'-nospanobjects'; zStream:=TMemoryStream.Create; try WPRichText.SaveToStream(zStream,WPRichText.TextLoadFormat); zStream.Position:=0; WPRichText.TextLoadFormat:=WPRichText.TextLoadFormat+sAddToFormat; WPRichText.Clear; WPRichText.LoadFromStream(zStream); finally zStream.Free; end; end; WPRichText.RTFData.RTFProps.Attributes.EnumCharAttr(nil, CreateFontAndSize); WPRichText.DefaultAttr.SetFontName(fName); WPRichText.DefaultAttr.SetFontSize(Size); par := WPRichText.RTFData.FirstPar; while par<>nil do begin par.ADel(WPAT_CharFont); par.ADel(WPAT_CharFontSize); par := par.next; end; for i:=0 to WPRichText.ParStyles.Count-1 do begin WPRichText.ParStyles[i].TextStyle.ADel(WPAT_CharFont); WPRichText.ParStyles[i].TextStyle.ADel(WPAT_CharFontSize); end; //WPRichText.ReformatAll(true, false);// Not required for HTML savingend;
Here's where I call it in ppWPTools:
Code
Alles anzeigenprocedure TppDBWPTRichText.LoadWPTRichText; begin // Gets the text if we have a valid pipeline if CheckForPipelineData then begin try RichText := DataPipeline.GetFieldAsString(DataField); except SetRichText(ppLoadStr(414)); // Error Loading RichText end; end else RichText := ''; // Give the user the chance to change the text inherited LoadWPTRichText; WPToolsForceFont(Self.WPRichText,Self.Font.Size,Self.Font.Name);//2008-11-24 end;
-
Julian,
I just sent you an email with a test project attached. -
Here's the results, I'm trying to force smaller font (8pt), and I'm still seeing some of it in larger type:
HTML
Alles anzeigen<html> <head> <style><!-- p.MsoNormal{mso-style-parent:'""';font-size:12.00pt;font-family:'Times New Roman';margin:0.00in;} li.MsoNormal{mso-style-parent:'""';font-size:12.00pt;font-family:'Times New Roman';margin:0.00in;} div.MsoNormal{mso-style-parent:'""';font-size:12.00pt;font-family:'Times New Roman';margin:0.00in;} span.EmailStyle15{font-family:'Arial';} .@page Section1{margin:1.00in;} div.Section1{} --></style></head><body> <div><span style="font-size:11.00pt;">The investigator will construct a variety ofrecombinant replication-defective adenoviruses.<span> The investigator’s primary area of interest is to use the viral vectorin the study of fetal lung development.<span> In order to transfect the cells used in the investigations, the investigator must use the adenovirus to infect the cells, allowing for the transmission of exogenous DNA.<span> These viruses will carry either DNA fusion constructs capable of expressing proteins in transfected cells or DNA fusion constructs used as reporters of cloned promoter sequences.<span> The viruses do not have theability to replicate and carry out viral function in cells that are not transformed with an Ela oncogene.<span> The viruses will be produced by infection of HEK 293 cells that expresses the protein of interest.<span> The estimated viral concentration will be100 ml of 1.0 x 10<sup>9</sup> pfu/ml.<span> Rats of fetal, juvenile and adult age will be used to obtain lung tissue for primary cell culture.<span> In addition human fetal lung cells will be used. Cell transfections in the multiplicity of infection<span style="font-size:11.00pt;font-family:'Arial';"> <span style="font-size:11.00pt;">range<span style="font-size:11.00pt;font-family:'Arial';"> <span style="font-size:11.00pt;">of 0.1 to 500, requiring 1.0 X 10<sup>7</sup> – 5.0 X10<sup>10</sup> recombinant virus will be performed in a biological safety cabinet.<span> At this point, the number of various recombinant adenoviruses to be made depends on the direction of the research.<span> Dr. Alcorn would like a blanket approval to make several varieties, but does not anticipate more than 15 recombinant constructs.<span><br/><br/></div> <p class="MsoNormal"><span style="font-size:10.00pt;font-family:'Arial';">This <span style="font-size:16.00pt;font-family:'Arial';">is a <span style="font-size:10.00pt;font-family:'Arial';">Test.<span> <br/></p> </body></html>
Here's the html:
-
In my first attempt at this I added my own options to the WPIOHTML unit, but the results were inconsistent. I abandoned that, and tried the approach of iteration through the paragraphs, but I think that method is really for RTF format, and not for HTML. How can I iterate through each tag in the HTML?
Here's the code for the paragraphs, but I think b/c some paragraphs have several tags, some of the fonts get missed, still showing the larger font. (I'm trying to make them respect the font set in the ReportBuilder dialog properties of the TppDBWPTRichText so at the end of TppDBWPTRichText.LoadWPTRichText, I call:
...inherited LoadWPTRichText;
WPToolsForceFont(Self.WPRichText,Self.Font.Size,Self.Font.Name);//2008-11-24
end;Then, here's the procedure:
Code
Alles anzeigenprocedure TppCustomWPTRichText.WPToolsForceFont(zRichText:TWPCustomRtfEdit;FontSize:integer;FontName:String);//2008-11-24 Dan Armstrong var par:TParagraph;//send blank for fontname or 0 for Fintsize if you want to ignore either one x:integer; zStyle:string; stynr: Integer; begin zStyle:='CharFont:'''+FontName+''';CharFontSize:'+IntToStr(FontSize*100)+';'; if zRichText.ParStyles.GetID('EHSA_USER')=0 then//style is not there, add it zRichText.ParStyles.Add('EHSA_USER').TextStyle.ASetWPSS(zStyle, false,false); stynr := zRichText.ParStyles.GetID('EHSA_USER'); //det as the default zRichText.WritingAttr.Clear; if FontName<>'' then zRichText.WritingAttr.SetFontName(FontName); if FontSize>0 then zRichText.WritingAttr.SetFontSize(FontSize); //don't allow different in a paste if FontName<>'' then zRichText.ClipboardOptions:=zRichText.ClipboardOptions+[wpcoDontPasteFonts]; if FontSize>0 then zRichText.ClipboardOptions:=zRichText.ClipboardOptions+[wpcoDontPasteFontSizes]; //loop through existing data, and apply the default font/style par := zRichText.Memo.RTFData.FirstPar; while par <> nil do begin zRichText.SelectParagraph(par); if FontSize>0 then begin //zRichText.SelectedTextAttr.SetStyle(stynr,true,true); //par.SetStyle(stynr,true,true); //par.ClearCharAttributes(true); zRichText.SelectedTextAttr.SetFontSize(FontSize); if par.Style>0 then par.ASet(WPAT_CharFontSize, FontSize*100); //zRichT //zRichText.SelectedTextAttr.AGet(WPAT_CharFontSize,x); //zRichText.SelectedTextAttr.ASet(WPAT_CharFontSize,8); end; if FontName<>'' then zRichText.SelectedTextAttr.SetFontName(FontName); par := par.globalnext; end; zRichText.ReformatAll(true,true); zRichText.Repaint; //TWPRichText(Sender).Repaint; //zRichText.SaveToFile('c:\result.html'); end;
To sum up, I want to do the same thing, but I want to do it tag-by-in the html, as opposed to par-by-par. Does that make sense? -
I collect info In HTML from end-users (online, so In a non-wpRichtext component in which I don't have control over font size), and I run a report using report Builder ppWPRichtext. For the report only, to save space ansnd have consistent format, I'd like to ignore the font size specified in the HTML. Is there a simple property setting I can set to ignore fontsize (whether done with style or otherwise), I do I need to loop through styles/attributes? Anyone have an example? Thanks.
-
Anyone know how to add Target="_blank" to hyperlinks to hyperlinks that a user enters a hyperlink that starts with "http://" ? I'd like to do it with an event, not have to modify the source. I'm using the wpDefEditor.
-
Thanks Julian. That's what I needed.
-
The distinction is lost on me. Shouldn't the mailmerge just replace the "Responsible_Person_Name" part, and not mess with the font part?
I can programmatically set the font with Contents.MergeAttr.SetFontName('Arial') , but I want the font that the user intended, which I thought I could get with MergeAttr.GetFontName(x) before replacing the StringValue, but it's blank (event though the html before snippet shows it in there. Is the some Contents.Option that I need to have set differently?
-
The font is set for the field object. It's arial, which is show in the before snippet above. Is it not?
-
Upon reading the post, I need to disable the before/after HTML snippets:
BEFORE Mailmerge:
<mergefield name="Responsible_Person_Name"><font face="Arial" color="black">Responsible_Person_Name</font></mergefield>AFTER Mailmerge:
<mergefield name="Responsible_Person_Name">Doright, Dudley</mergefield> -
Hi all,
I'm using:
Delphi 7
WPTools 24.01.2007 V5.0 Release 22I add mailmerge fields using the TwpDefEditor, the only change I made is I set the DefaultIOFormat='HTML', when I mailmerge, I lose the font.
HTML snippet BEFORE performing mailmerge:
<mergefield><font>Responsible_Person_Name</font></mergefield>HTML snippet AFTER performing mailmerge:
<mergefield>Doright, Dudley</mergefield>I've also tried doing the mailmerge two ways, with the OnGetMailMergeText event and using the TWPMMDataProvider component, with the same result.
Am I neglecting to do something?
-
OK, I ran the export procedures, on the differen machines, and Right after "PrintTo Devices" line, I save the TppReport component to a text file. The difference on that machine is that TppReport.PrinterSetup.PaperSize = 1 on the ones that render properly and TppReport.PrinterSetup.PaperSize = 0 on the one that has the "squished" ppWPDBRichText output. Does This property affect either wPDF or WPTools?