C++ API för att exportera MSG till DOCX

Förvandla MSG till DOCX i C++-applikationen utan att behöva Microsoft Word eller Outlook

 

Är du en C++-utvecklare som vill lägga till funktioner för e-postkonvertering i dina applikationer? Genom att använda Aspose.Msg for C++ kan du konvertera MSG-filformat till HTML. Efter det, genom att använda Aspose.Words for C++ API, kan du exportera HTML till DOCX. Båda API:erna kommer under paketet Aspose.Total for C++ .

C++ API för att konvertera MSG till DOCX

  1. Öppna MSG-filen med MailMessage klassreferens
  2. Konvertera MSG till HTML genom att använda medlemsfunktionen Save
  3. Ladda HTML genom att använda klassen Document
  4. Spara dokumentet i DOCX-format med metoden Save och ställ in Docx som SaveFormat

Konverteringskrav

Installera från kommandoraden som nuget install Aspose.Total.Cpp eller via Package Manager Console of Visual Studio med Install-Package Aspose.Total.Cpp.

Alternativt kan du hämta offline MSI-installationsprogrammet eller DLL-filer i en ZIP-fil från downloads .

// load the MSG file to be converted
System::SharedPtr<MailMessage> msg = MailMessage::Load(u"sourceFile.msg");
// save MSG as a HTML 
msg->Save(u"HtmlOutput.html", SaveOptions::get_DefaultHtml());  
// load HTML with an instance of Document
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"HtmlOutput.html");
// call save method while passing Docx as save format
doc->Save(u"convertedFile.Docx");

Analysera MSG-fil via C++

Du kan inte bara konvertera din MSG till DOCX, utan du kan läsa, manipulera och analysera MSG-dokument. Du kan få ämne, adress, text, mottagares information för e-postmeddelandet genom att använda MapiMessage-klassen av Aspose.Msg for C++ API. Du kan till exempel söka efter en specifik avsändar-e-post för konverteringen genom att använda egenskapen get_SenderMsgAddress().

// create an instance of MapiMessage from file
System::SharedPtr<MapiMessage> msg = MapiMessage::FromFile(dataDir + L"message.msg");
// get subject
System::Console::WriteLine(System::String(L"Subject:") + msg->get_Subject());
// get from address
System::Console::WriteLine(System::String(L"From:") + msg->get_SenderMsgAddress());
// get body
System::Console::WriteLine(System::String(L"Body") + msg->get_Body());
// get recipients information
System::Console::WriteLine(System::String(L"Recipient: ") + msg->get_Recipients());

C++ API för att begränsa redigering av DOCX-filformat

Du kan också lägga till dokumentskyddsfunktioner i din app medan du exporterar dokumentet från MSG till DOCX. Att lägga till skydd till ditt dokument är en enkel process, eftersom allt du behöver göra är att tillämpa skyddsmetoden på ditt dokument. Du kan ställa in skyddstypen på Skrivskyddad för att begränsa användaren att redigera dokumentet.

// create a new document and protect it with a password.
auto doc = System::MakeObject<Document>();
// apply Document Protection.
doc->Protect(ProtectionType::ReadOnly, u"password");
// save the document.
doc->Save(u"DocumentProtection.PasswordProtection.Docx");

Utforska MSG konverteringsalternativ med C++

Konvertera MSGs till BMP (Bitmap Image File)
Konvertera MSGs till DOC (Microsoft Word Binary Format)
Konvertera MSGs till DOCM (Microsoft Word 2007 Marco File)
Konvertera MSGs till DOCX (Office 2007+ Word Document)
Konvertera MSGs till DOT (Microsoft Word Template Files)
Konvertera MSGs till DOTM (Microsoft Word 2007+ Template File)
Konvertera MSGs till DOTX (Microsoft Word Template File)
Konvertera MSGs till EMF (Enhanced Metafile Format)
Konvertera MSGs till EPUB (Open eBook File)
Konvertera MSGs till FLATOPC (Microsoft Word 2003 WordprocessingML)
Konvertera MSGs till GIF (Graphical Interchange Format)
Konvertera MSGs till PNG (Portable Network Graphic)
Konvertera MSGs till JPEG (Joint Photographic Expert Group)
Konvertera MSGs till MD (Markdown Language)
Konvertera MSGs till ODT (OpenDocument Text File Format)
Konvertera MSGs till OTT (OpenDocument Standard Format)
Konvertera MSGs till PCL (Printer Command Language Document)
Konvertera MSGs till PDF (Portable Document Format)
Konvertera MSGs till PNG (Portable Network Graphic)
Konvertera MSGs till PS (PostScript File)
Konvertera MSGs till RTF (Rich Text Format)
Konvertera MSGs till SVG (Scalar Vector Graphics)
Konvertera MSGs till TIFF (Tagged Image File Format)
Konvertera MSGs till DOCX (Office 2007+ Word Document)
Konvertera MSGs till WORDML (Microsoft Word 2003 WordprocessingML)
Konvertera MSGs till XPS (XML Paper Specifications)
Konvertera MSGs till BMP (Bitmap Image File)
Konvertera MSGs till DOC (Microsoft Word Binary Format)
Konvertera MSGs till DOCM (Microsoft Word 2007 Marco File)
Konvertera MSGs till DOT (Microsoft Word Template Files)
Konvertera MSGs till DOTM (Microsoft Word 2007+ Template File)
Konvertera MSGs till DOTX (Microsoft Word Template File)
Konvertera MSGs till EMF (Enhanced Metafile Format)
Konvertera MSGs till EPUB (Open eBook File)
Konvertera MSGs till FLATOPC (Microsoft Word 2003 WordprocessingML)
Konvertera MSGs till GIF (Graphical Interchange Format)
Konvertera MSGs till JPEG (Joint Photographic Expert Group)
Konvertera MSGs till MD (Markdown Language)