ต้องการแปลงเอกสารจากรูปแบบหนึ่งเป็นอีกรูปแบบหนึ่งโดยทางโปรแกรมหรือไม่? ด้วย Aspose.Words สำหรับ C++ คุณสามารถแปลงไฟล์โดยใช้โค้ด C++.
C++ อันทรงพลังช่วยให้สามารถแปลงเอกสารเป็นรูปแบบยอดนิยมมากมายด้วยคุณภาพระดับมืออาชีพ:
ตัวอย่างต่อไปนี้สาธิตวิธีการแปลงเอกสารใน C++ โหลดไฟล์จากไดรฟ์ในเครื่อง จากนั้นบันทึกโดยระบุรูปแบบไฟล์ที่ต้องการในส่วนขยาย สำหรับไฟล์อินพุตและเอาต์พุต คุณสามารถใช้ชื่อไฟล์แบบเต็มได้ เนื้อหาเอาต์พุตและการจัดรูปแบบจะเหมือนกับเอกสารต้นฉบับ
dotnet add package Aspose.Words.Cpp
สำเนา
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
doc->Save(u"Output.pdf");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
doc->Save(u"Output.pdf");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
for (int page = 0; page < doc->get_PageCount(); page++)
{
saveOptions->set_PageSet(MakeObject<PageSet>(page));
doc->Save(String::Format(u"Output_{0}.pdf", page + 1), saveOptions);
}
using namespace Aspose::Words;
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(u"Input.docx");
doc->Save(u"Output.pdf");
using namespace Aspose::Words;
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto shape = builder->InsertImage(u"Input.docx");
shape->GetShapeRenderer()->Save(u"Output.pdf", MakeObject<ImageSaveOptions>(SaveFormat::Svg));
มีสามตัวเลือกในการติดตั้ง Aspose.Words for C++ ในสภาพแวดล้อมของนักพัฒนาซอฟต์แวร์ของคุณ โปรดเลือกหนึ่งรายการที่ตรงกับความต้องการของคุณและทำตามคำแนะนำทีละขั้นตอน:
คุณสามารถใช้ไลบรารี C++ นี้เพื่อพัฒนาซอฟต์แวร์บน Microsoft Windows, Linux และ macOS:
หากคุณพัฒนาซอฟต์แวร์สำหรับ Linux หรือ macOS โปรดตรวจสอบข้อมูลเกี่ยวกับการพึ่งพาไลบรารีเพิ่มเติม (แพ็คเกจโอเพ่นซอร์ส fontconfig และ mesa-glu) ในเอกสารประกอบผลิตภัณฑ์