In all our db-viewers (Paradox, dBase, DBISAM, Clarion) I added the possibility to generate the PDF file with table of records
Category: Soft/Programming
-
SMExport: Embedded images in html
Today I added the new feature for TSMExportToHTML component – the possibility to generate the html file with embedded images. Unfortunately the old IE (5/6) do not support this feature but FireFox, Opera, Safari will open the file without any problem
A few links:
http://www.sweeting.org/mark/blog/2005/07/12/base64-encoded-images-embedded-in-html
http://rifers.org/blogs/gbevin/2005/4/11/embedding_images_inside_html
Note: large images will not displayed due some limits in browser for encoded string -
C#: convert document to PDF
Today I wrote small code to convert the document (.doc, .rtf etc) ionto PDF format using MS Word 12/2007 automation:
using Word = Microsoft.Office.Interop.Word; private void SaveRTFToPDF(string RTFFileName, string PDFFileName) { object oMissing = System.Reflection.Missing.Value; Object oTrue = true; Object oFalse = false; object ReadOnly = false; object IsVisible = true; object RTFFile = RTFFileName; object PDFFile = PDFFileName; Word._Application oWord = new Word.Application(); Word._Document oDoc = oWord.Documents.Open(ref RTFFile, ref oMissing, ref ReadOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref IsVisible, ref oMissing, ref oMissing, ref oMissing, ref oMissing); object FileFormat = Word.WdSaveFormat.wdFormatPDF; object LockComments = false; object AddToRecentFiles = true; object ReadOnlyRecommended = false; object EmbedTrueTypeFonts = false; object SaveNativePictureFormat = true; object SaveFormsData = true; object SaveAsAOCELetter = false; object InsertLineBreaks = false; object AllowSubstitutions = false; object LineEnding = Word.WdLineEndingType.wdCRLF; object AddBiDiMarks = false; oDoc.SaveAs(ref PDFFile, ref FileFormat, ref LockComments, ref oMissing, ref AddToRecentFiles, ref oMissing, ref ReadOnlyRecommended, ref EmbedTrueTypeFonts, ref SaveNativePictureFormat, ref SaveFormsData, ref SaveAsAOCELetter, ref oMissing, ref InsertLineBreaks, ref AllowSubstitutions, ref LineEnding, ref AddBiDiMarks); oDoc.Close(ref oFalse, ref oMissing, ref oMissing); oWord.Quit(ref oMissing, ref oMissing, ref oMissing); }Sample to use:
SaveRTFToPDF(@"d:\C#\rtf2pdf\rtf\10-052561_1.RTF", @"d:\C#\rtf2pdf\rtf\10-052561_1.pdf"); SaveRTFToPDF(@"d:\C#\rtf2pdf\rtf\10-052561_2.RTF", @"d:\C#\rtf2pdf\rtf\10-052561_2.pdf"); SaveRTFToPDF(@"d:\C#\rtf2pdf\rtf\10-072410.RTF", @"d:\C#\rtf2pdf\rtf\10-072410.pdf"); SaveRTFToPDF(@"d:\C#\rtf2pdf\rtf\10-080976.RTF", @"d:\C#\rtf2pdf\rtf\10-080976.pdf"); SaveRTFToPDF(@"d:\C#\rtf2pdf\rtf\10-087077.RTF", @"d:\C#\rtf2pdf\rtf\10-087077.pdf");
I tried to convert the rtf into PDF using Crystal Reports. Just to generate the report form on fly from code and print there the RichTextBox.
But unfortunatelly only simple rtf-files exported as PDF in such way because Crystal Reports supports the limited syntax of rtf-format.
For example, header/footer of rtf-files is not converted correctly and images are not saved at all. -
affiliates from ShareIt
In last few days I got a lot of requests to approve the new affiliates via ShareIt control panel. I added only the BetaNews, DownloadPipe and Lockergnome. All others are not added and not declined.
Do not know why they want to add my products because the affiliates do not work for me. Seems like ShareIt sent the mails to own large affiliates with list of products and I’m there.
-
formating number
function GetFormattedNumber(Value: Double): string; function GetLastPos(const s: string): Integer; begin Result := Pos(DecimalSeparator, s)-1; if (Result < 1) then Result := Length(s) end; var i: Integer; begin Result := FloatToStr(Value); i := 3; while (i < GetLastPos(Result)) do begin Insert(' ', Result, GetLastPos(Result)-i+1); Inc(i, 4) end; end;Sample to use:
lblTotal.Caption := GetFormattedNumber(123456.789);
Why I wrote this function? In Delphi I could use the FormatFloat(‘,###’, dbl) but FormatFloat uses the thousand separator which is defined in MS Windows (#160 by default). I need the space char always
-
Viewer for Crystal Reports (*.rpt)
Today I wrote for Ethan the small tool – viewer for .rpt files.
User need select the directory with saved report forms, specify the logon info for MS SQL and view/save as pdf the any report:There I used the C# because viewer requires the Crystal Reports runtime library and I have the merge modules (for setup/install) only in MS Visual Studio 2003. Didn’t find in CodeGear/Embacadero disks.
The setup (.msi) created in MS Visual Studio 2003 too -
C#: enable XP theming for application
1. use the manifest (compile as resource or as external file)
2. call the EnableVisualStyles method for Application in Main():static void Main() { Application.EnableVisualStyles(); Application.Run(new frmMain()); } -
abadev server
Paid now for the next year of server hosting in Canada datacenter.
-
TSMExportToJSON component
In SMExport I added the new component to support the JavaScript Object Notation
The format of generated samples are available at http://www.json.org/example.htmlFor example:
{
“RECORD”: {
“Species No”: 90020
“Category”: “Fish”
“Common_Name”: “CommonFish 828”
“Species Name”: “Fish 275”
“Length (cm)”: 50
“Length_In”: 19,6850393700787
}
}The dates encoded as the number of milliseconds since January 1st 1970. See the topic for this subject at
http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspxThe binary values encoded in Base64 (same as in xml)
-
FireFox preferencies: about:config
If type the “about:config” in addressbar (instead URL), you’ll see the list of all supported preferencies of FireFox.
For example, to disable the antivirus scan after file download, you need set the value for browser.download.manager.scanWhenDone attribute in false