I am having trouble unzipping files using the Delphi 3rd Party component FlexCompress. Here is the Code, detailed explanation after the code:
MyZipReader := TFlexCompress.Create(myComponent);
MyZipReader.Name := 'MyReader';
MyZipReader.FileName := DataPath; //e.g. C:\Users\thisUser\AppData\Local\Temp\ThisTempFolder\ThisZip.zip
MyZipReader.OpenArchive(fmOpenRead);
MyZipReader.BaseDir := BasePath; //e.g. C:\Users\[...]\ThisTempFolder\UnzipHere\
MyZipReader.CreateDirs := TRUE;
MyZipReader.ExtractCorruptedFiles := TRUE;
MyZipReader.ExtractFiles := ('*.*');
MyZipReader.closeArchive;
All files will be extracted and placed accordingly, so that's OK.
BUT: All files are empty. No text no nothing.
I have no idea what I am doing wrong. If I extract an archive I packed with Flexcompress everything is OK but if I try this with an external archive this behaviour occurs. Is there some sort of switch I am missing? I would be grateful about every tip or idea! I also tried the options ReplaceReadOnly and overwriteMode. Did not help and I am out of Ideas. If anyone knows some sort of FlexCompress forum I would also appreciate a link, maybe I could find info there? Sadly componentAce does not seem to host something like this.
Edit(2021.12.14 - 1.17pm)
Extra information gathered in the process:
One should not set the ExtractCorruptedFiles property to TRUE. This will prevent the eventhandler from raising an exception within the extractFiles() procedure
I need run a report (TQuickRep) for export only, without printing or showing.
The Prepare method does nothing.
The beforeprints or afterprints events doesn´t fires.
Ex.
var rep: TMyQuickRep; //TMyQuickRep is a report TQuickRep
begin
rep := TMyQuickRep.Create(Self);
try
rep.SomeData := somedata;
rep.DataSet := somDataSet;
rep.Prepare;
//rep.Run? there isn´t a method for run
rep.ExportToFilter(TQRPDFDocumentFilter.Create('c:\temp\myreport.pdf'));
//pdf is an empty page
finally
FreeAndNil(rep);
end;
end;
This should work for you...( I was looking for a solution just like this and the code below worked for me.)
rep.ExportToFilter(TQRPDFDocumentFilter.Create('c:\temp\myreport.pdf'));
rep.Print;
Delphi XE6. I have an application for text snippets, which are stored in a local Database (ABS DB). Some snippets may be straight text, others may include formatting. If the snippets include formatting, the snippets are MS Word format.
The user can view the snippets in two ways, inside my app, or by calling MS-Word, and having the snippet loaded there automatically, - IT IS THE SAME SNIPPET ..
Issue: If the snippet is loaded into a TOLEContainer in my app, it displays fine without a problem... If the snippet gets spawned off into MSWord, I get an error...
"We're sorry. We can't open because we found a problem with its contents." I click on OK, and then get "Word found unreadable content in . Do you want to recover the contents of this document?..." I clik OK, and everything displays fine.
My general processing flow for the "spawn off MS WORD" is...
// FN is a temp file name
FileStream := TFileStream.Create(FN, fmCreate);
BlobStream := dm_text.tEntries.CreateBlobStream(dm_text.tEntries.FieldByName('ANSWER_FMT'), bmRead);
FileStream.CopyFrom(BlobStream, BlobStream.Size);
BlobStream.Free;
FileStream.Free;
// Now open default association, which will be Word
ShellExecute(Handle, 'open', PWideChar(FN), nil, nil, SW_SHOWNORMAL);
This flow is nearly identical for the In place viewing... other than a few commands for the TOleContainer.
OleWord.Enabled := True;
FileStream := TFileStream.Create(FN, fmCreate);
BlobStream := tEntries.CreateBlobStream(tEntries.FieldByName('ANSWER_FMT'), bmRead);
FileStream.CopyFrom(BlobStream, BlobStream.Size);
BlobStream.Free;
FileStream.Free;
OleWord.LoadFromFile(FN);
OleWord.DoVerb(ovInPlaceActivate);
Any ideas why this is happening? This happens on MULTIPLE versions of MSWord.
ADDITIONAL INFO:
Both routines look at the same data, pulled from the exact same row/column in my DB. What I do is create a TEMP file, and then load either via TOleContainer, which loads it fine, or via ShellExecute, which gives an error. However, if I manually load the TEMP file for the OLE Container into MSWord, I get the same error.
So - possibilities...
1). My data is corrupted, i.e. how I save it is wrong...but Word can correct it.
2). I have a setting somehow so that OLEContainer doesn't show the error but Word does.
It is because when using OleContainer.SaveToFile or SaveAsDocument, you are not creating a docx file, but an OleObject containing a docx file. When using OleContainer.SaveToFile with UseOldStreamFormat = True, there is even a Delphi specific header added. Word fortunatly detects this and gives you the option to restore the file.
If you want a valid word-document, then activate the OleContainer (OleContainer.DoVerb(ovPrimary) and then save the document via Word itself (OleContainer.OleObject.SaveAs(MyFileName, wdFormatDocument, EmptyParam, EmptyParam, False).
After that you can store the resulting file in your database.
I'm trying to call Chromium Dev Tools with this code from dcef3 demos:
procedure TMainForm.actDevToolExecute(Sender: TObject);
begin
actDevTool.Checked := not actDevTool.Checked;
debug.Visible := actDevTool.Checked;
Splitter1.Visible := actDevTool.Checked;
if actDevTool.Checked then
begin
if not FDevToolLoaded then
begin
debug.Load(crm.Browser.Host.GetDevToolsUrl(True));
FDevToolLoaded := True;
end;
end;
end;
When i'm running programm, and pressing DevTools button, nothing happens, empty window, empty source code.
For Debug im trying this:
showmessage(crm.Browser.Host.GetDevToolsUrl(True));
And it return nothing(empty string).
But this code Works Fine in dcef3 guidemo... And not works in my Programm.
Whats a problem?
Here is dcef3 guiclient demo Full Code - http://dumpz.org/589068/
Thanks
Searching yields a discussion on Google Groups where Henri Gourvest explains that for the dev-tools URL to work, you need to define a debugging port. For example:
CefRemoteDebuggingPort := 9000;
If that doesn't work, then you need to compare your code with the working demo and identify what else you're doing differently.
My D5 application can currently mail merge multiple members data to a Word document using:
wrdapp := CreateOleObjct(word.application);
wrdDoc := wrdApp.Document.Open(TemplateLocation);
wrdMailMerge := wrdDoc.MailMerge;
populateMailMergeDateFile;
wrdMailMerge.execute;
and then
wrdDoc.Saved := False;
wrdDoc.Close(False);
wrdApp.Visible := True;
I would like to offer the option of passing the merged document straight to the printer. However I cannot find the code which allows this to happen
wrdDoc.PrintOut;
wrdDoc.Saved := False;
wrdDoc.Close(False);
Prints out the template document with no merged data.
wrdDoc.Saved := False;
wrdDoc.Close(False);
wrdDoc.PrintOut;
Displays a variant object error.
wrdMailMerge.PrintOut;
Displays an automation errors.
I've tried using True instead of False as well. Can anybody advise me as to how to print the merged document correctly?
many thanks
In my mailmerge code, I set MailMerge.Destination to wdSendToNewDocument before executing the merge, then afterwards I call WordApplication.ActiveDocument.Printout.