How can I open .docx files in MFC?
Because when I open a .docx file it puts "PK" to the editor. (This is at every .docx file I have opened)
.docx files are .zip files with a different extension. The content of the zip is essentially a directory structure containing various XML files.
To open a .docx in a text editor would basically require unzipping the file to a directory then opening each XML file in your editor.
The actual format of .docx files can be found online.
Related
I have written a small c++ program to read the content of a .XML file.
It works as a console application. But when I compile the project as a .dll it gives no error but ignores the .XML Content.
My question is how to include the .XML file into my .dll
I am using the Code::Blocks IDE. I set the checkmark with options->compile when right-clicking on the .XML file, but this doesn't help. I also tried to include the .XML in my code with
#include <data.xml>
but now I get error Messages. Please help.
I have found a workaround for my problem:
I define the content of my .XML file as a string xml_message and then use
#include "data.xml"
xml_document doc;
doc.loadSring(xml_message.c_str())
instead of
xml_document doc;
doc.loadFile("data.xml");
Where should I save a text file before I open it on python?
I tried to open a text file on the desktop, but that generated an error.
I need to add a pdf file to my resource folder, which I can open from the application with the click of a button (kind of like a Help file).
So my confusions are:
How exactly do I add the pdf to my resources?
What path should I use to direct to the pdf?
QDesktopServices::openUrl(QUrl("/Resource Files/Help.pdf"));
To add the resource file into your project, right click on the project in the Projects pane and click Add New... and then Qt>Qt Resource file, enter a name for it and after finishing something is added to your .pro file like :
RESOURCES = myResource.qrc
Once added into the pro file, a separate .qrc file will be added into your Qt project with which you can double click and add your desired resources like icons, translation files etc. Open the resource file and add your pdf file there.
To open the pdf file from resources, you should first copy it to some location for example in the application directory path :
QFile HelpFile("qrc:/myFile.pdf");;
HelpFile.copy(qApp->applicationDirPath().append("/myFile.pdf"));
Next you can open the pdf file by :
QDesktopServices::openUrl(QUrl::fromLocalFile(qApp->applicationDirPath().append("/myFile.pdf")));
I have written an application to compress the contents of directory to a .zip file from C++, using zlib and minizip. Minizip is not well documented online but the file "zip.h" in the source code contains comments.
My application uses FindFirstFile and FindNextFile to get a list of all files (and subfolders) in the directory and then, as shown here How do I use Minizip (on Zlib)? creates a .zip file and opens new files within the .zip.
Then I read the source files with fopen and fread and write the contents to the newly created files in the .zip folder. This all works just fine if the directory to be compressed contains only files, and no subfolders, but I cannot decipher from the comments in the source code how I add a new folder to a .zip file and then write files to that folder.
As it turns out, you don't need to create a new directory in the .zip file as a separate step. You can just pass the parameter "foldername\filename.ext" to the zipOpenNewFileInZip method and it will create the "foldername" directory for you then add a new file "filename.ext" to that directory.
I wanted to open a zip file (mod.zip) and move the file inside, to another zip file (minecraft.zip) and owerwrite the file with same names.I hope you understand because im not english.
I dont know if i can open zip files or i need libraries
I would recommend 7zip SDK, it lets you zip and unzip things in .7z and .zip and many other formats