misc_bb
Members-
Content Count
65 -
Joined
-
Last visited
Everything posted by misc_bb
-
New Delphi job opportunity
misc_bb replied to Berocoder's topic in Job Opportunities / Coder for Hire
I'd love to see Delphi opportunities as well. Looking forward to seeing them as I am very much interested. I've worked with Delphi 7 but currently I'm now working with Delphi 11 focusing mostly on using Delphi as backend for a web application with primary task on integrating accounting software such as Xero, Quickbooks and MYOB. Should there be any opportunities in this area, hit me up. 🙂 -
I have been using PDFtk (https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) in our Delphi apps to merge documents. I haven't tried splitting but PDFtk has also the splitting function. you may want to give it a try. As for our case, we utilized the command prompt and we just issue a call Shellexecute in our app. Works just fine.
-
Currently we have a web app with Delphi as a backend. We are planning to incorporate NodeJS as well because we want to take advantage of some JS libraries like a headless browser in our application. I am still not sure if this would work out just fine since I'm currently exploring. I just wanted to ask if someone else have tried this setup before I fully dive into this. Any thoughts or comments are appreciated. Thank you.
-
I know a lot of you might have worked with reading and writing Excel sheets with Delphi. I would like to ask if its possible to read an excel file without opening it?
-
@corneliusdavid Thank you. I think I'll go for this library. @Dave Nottage I'm currently using OLE but wanted to avoid Excel app from opening. Thank you for the suggestion but I've been thru a lot with OOXML working with docx files, I don't want to go there for the mean time.
-
I think I've read this article as well. Not interested in buying yet but we'll see. Thank you.
-
Hello, I'm currently implementing a tool to handle an API using Delphi REST components. The API we are dealing with returns a PDF file. Can Delphi handle REST this file type? I don't see any file type/content type option in the object inspector. I've made some testing it doesn't seem to replicate what I have in Postman. Anyone have tried using Delphi REST with a PDF file as response? I just want to know otherwise I'll shift to Python. Thanks in advance.
-
After some trial and error again, was able to figure it out. This integration is with the Datylon API & Delphi REST components which handles a PDF return type. Although free account in Datylon doesn't work with this API integration. If anyone want to implements the API or something similar, the following code can be utilized. You just need to add some error handling. Getauthorization - a function that return the Basic authentication with username and password 64bit encoded, small letter 'a' in 'authorization' is from datylon documentation templateid and datasource - these are datylon parameters that needs be followed based on Datylon documentation JSONStr - this is actually the JSON string that needs to be sent TRY RESTRequest := TRESTRequest.create(nil); RESTRequest.Client := TRESTClient.create(RESTRequest); RESTRequest.SynchronizedEvents := False; RESTRequest.Client.UserAgent := DatylonUserAgent; RESTRequest.Client.FallbackCharsetEncoding := 'raw'; RESTRequest.Client.BaseURL := datylon_BaseURI; RESTRequest.Client.ContentType := 'application/json'; RESTRequest.Client.Params.AddItem('authorization', Getauthorization, TRESTRequestParameterkind.pkHTTPHEADER, [TRESTRequestParameterOption.poDoNotEncode]); RESTRequest.Client.Params.AddItem('x-graph-template-id', templateid, TRESTRequestParameterkind.pkHTTPHEADER, [TRESTRequestParameterOption.poDoNotEncode]); RESTRequest.Client.Params.AddItem('x-graph-datasource-name', datasource, TRESTRequestParameterkind.pkHTTPHEADER, [TRESTRequestParameterOption.poDoNotEncode]); RESTRequest.Body.ClearBody; RestRequest.body.Add(JSONStr, ctAPPLICATION_JSON); // RESTRequest.Resource := 'render'; RESTRequest.Method := rmPOST; RESTRequest.Response := TRESTResponse.Create(RESTRequest); RESTRequest.Accept := 'application/pdf'; RESTRequest.Execute; Codesite.Send('AuthenticationProcess Result: ' + RESTRequest.Response.Content); Result := RESTRequest.Response.RawBytes; finally RESTRequest.Free; end; This code result will return rawbytes which you need to convert to a file. You need the FallbackCharsetEncoding to 'raw' - this I'm not sure but I've read this from here: https://community.embarcadero.com/de/component/easydiscuss/rest-request-error-to-get-pdf-attached-berlin-10-1?Itemid=1 I'm not even sure if it made a difference but I lost track of it which ones is working and which one is not when I was doing my trial and error. 🤣 the ultimate goal is to make it work haha This is for the bytes to file conversion: procedure TfrmMain.SaveBytesToFile(const Data: TBytes; const FileName: string); var Stream: TFileStream; begin Stream := TFileStream.Create(FileName, fmCreate); try if Data <> nil then Stream.WriteBuffer(Data[0], Length(Data)); finally Stream.Free; end; end; //This will call the REST function above RestResultFile := API.PDFProcess(LoadTextFromFile('text1.txt')); //text file here contains the JSON string SaveBytesToFile(RestResultFile, 'test.pdf'); Thank you guys for your ideas. It led me to this solution above. Cheers!
-
In my testing I encounter this result: {"Error":"Content type not recognized"} Should I explicitly specify the return type in code? In Postman, there's no need for that but I'm not sure with Delphi REST. I've dealt with other APIs before but those are all text, json values and Delphi REST works perfectly.
-
Thank you. I guess i'll just have to figure it out how to handle the return PDF file. @Mohammed Nasman Yes, Delphi MVC is very good but I think it's too much for what I require. Thank you.
-
Any recommendations for Delphi library for PDF handling? I'm currently working on merging multiple files into 1 pdf file. Fast-reports said it handle this, any thoughts?
-
I'm able to get the PID of a processname (ex: winword.exe) but interested of getting the PID of winword.exe based on a specific filename, is this possible? I was able to look capture the PID from winword but if there are multiple instance I can't kill all instance but only a specific one. I'm not so familiar with Winapi handling, based on this post: Delphi Get the handle of a EXE he is trying to change his approach from 'Window name' to an Exe name. But parameter @processid needs to be specified. How can I get the processid in this case based on filename or window name?
-
Thank you for the idea on this topic. I don't want to go the hard way I can probably do this one at a time. I'll just terminate winword after every documents' final save until the next document opens.
-
Anyone playing around with docx files and trying to update a table of contents via win32com? I've got a working one with Python but our production environment runs on 10.4 only and we're having issues compiling it with P4D. So, i'll just ask if anyone has some similar implementation of this Python code in Delphi? def update_toc(docx_file): word = win32com.client.DispatchEx("Word.Application") doc = word.Documents.Open(docx_file) doc.TablesOfContents(1).Update() doc.Close(SaveChanges=True) word.Quit() thanks in advance for your thoughts and comments.
-
Thank you @Remy Lebeau I'll give this a try. wow it does work! I never thought it was possible because in my readings, word needs to open the file in order to update the table of contents. Thanks again! 😉
-
python4delphi Python4Delphi module and Wrapping VCL classes
misc_bb replied to shineworld's topic in Python4Delphi
@pyscripter Is the TPythonModule going to be use when importing libraries? I'm sorry, I'm still trying to figure out myself with P4D 🙂 Thank you! -
Is the upgrade to 10.4.1 or 10.4.2 free? My boss doesn't want to pay additional subscription 🤣
-
Does this mean that if you are running 10.4, its a must to update to 10.4.1 to use P4D? No workaround?
-
I have the same error in 10.4 but I cannot update to 10.4.1. Does this mean I will have to utilized the installation use for 10.3?
-
Dynamic approach to building OOXML tables
misc_bb posted a topic in Algorithms, Data Structures and Class Design
Hi, just need some advise here. I working on OOXML for Docx file creation. so far its all good but when it comes to tables there are just too many settings to be configured to get our desired table look. I wanted to make this more dynamic and I'm thinking utilizing a TDictionary to handle and table style and the corresponding table configuration. Would this be a good option? Example table settings: <w:tbl> <w:tblPr> <w:tblStyle w:val="TableGrid"/> <w:tblW w:w="9648" w:type="dxa"/> <w:tblBorders> <w:top w:val="none" w:sz="0" w:space="0" w:color="auto"/> <w:left w:val="none" w:sz="0" w:space="0" w:color="auto"/> <w:bottom w:val="none" w:sz="0" w:space="0" w:color="auto"/> <w:right w:val="none" w:sz="0" w:space="0" w:color="auto"/> <w:insideH w:val="none" w:sz="0" w:space="0" w:color="auto"/> <w:insideV w:val="none" w:sz="0" w:space="0" w:color="auto"/> </w:tblBorders> <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/> </w:tblPr> </w:tbl> MyDictionary : TDictionary<string, TTableProperties>; //TTableProperties - Record or maybe an object Honestly I'm new with TDictionary will this option be feasible? Thank you! -
Working with OOXML in Delphi is.. interesting Now I can generate docx files by manipulating XML tags, although working with a library makes things easier. Now another hiccup is updating the table of contents. The only solution for now I have for now is the option where the user is prompted with a message box every time the Word document opens asking this screen below. I want to get rid of it or avoid this from showing up. If user selects "Yes", the table of contents is updated. This is also based on Eric White's blog: This option, is not always the best experience we want to our users. Has anyone encountered this before? Eric did mention Word automation using a macro and another is setting up word automatic services via a Sharepoint in the server, this is not going to be an option for now. So we want to automatically update TOC inside the docx file without prompting the user. If you have a suggestion, I would highly appreciate it. Thanks!
-
Updating Table of Contents in docx with OOXML
misc_bb replied to misc_bb's topic in Delphi Third-Party
Well, what I'm referring here is what other option I can do to update the table of contents. This pop up box will really display because I set 'w:updateFields' to true. This is basically part of the OOXML setup for Table of Contents. In LibreOffice/ODT file, what they normally do is open the file to perform the updating of the table of contents. You know what, I think I just have an idea how to get around with this. -
This problem seems to be a while already but I just experienced it now after reinstalling Delphi 10.4. I followed the updated ServiceUrl since I cannot access the Getit Package Manager but the loaded packages are not updated. Found the solution here especially on the offline installer: https://docwiki.embarcadero.com/RADStudio/Sydney/en/Release_Notes 😉
-
In the most important time bad things happens and my PC crashed all of a sudden and Windows Recovery is not helping either, giving only the option to reformat. We have a licensed for Delphi 10.4 but we decided not to renew subscription. Now after OS installation, I need to re-install Delphi again then I get this error that I need to update my subscription? Am I not allowed to use my Delphi license again?
-
Yeah, I do have some backup of my source code but the installation and the other apps are not. I'll probably need another drive for this. I am now working on reinstalling it again based on the original Delphi version. Thank you!