สวัสดีโลก!

Contents
[ ]

“สวัสดีโลก!“รหัสมักจะเป็นตัวอย่างง่ายๆครั้งแรกที่จะเขียนโดยตรง"Aspose.WordsสำหรับC++“และก็ยังสามารถนำมาใช้เป็นการทดสอบสติเพื่อให้แน่ใจว่าซอฟต์แวร์ที่มีวัตถุประสงค์เพื่.

“Aspose.WordsสำหรับC++“ห้องสมุดช่วยให้นักพัฒนาเข้าถึงโดยตรงในการสร้างแก้ไขผสานแปลงเปรียบเทียบคำและเ PDF, DOCX, DOC, RTF, ODT, EPUB, HTML และรูปแบบไฟล์อื่นๆอีกมากมาย รองรับ.

เป็นlow codeตัวอย่างทำตามขั้นตอนเหล่านี้:

  1. สร้างใหม่ว่างเปล่าDocument
  2. เริ่มใช้งานคลาสDocumentBuilder
  3. แทรกข้อความลงในเอกสารเริ่มด้วยวิธีง่ายๆWrite
  4. เปิดDocumentที่มีอยู่จากแฟ้ม ตรวจหารูปแบบไฟล์โดยอัตโนมัติ
  5. Appendเอกสาร"A"ไปยังและของเอกสาร"B”
  6. Saveผลลัพธ์เป็นPDF

ข้อมูลโค้ดต่อไปนี้คือ"สวัสดีโลก!“ตัวอย่างการจัดแสดงการทำงานของ"Aspose.WordsสำหรับC++” API:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C.git.
auto docA = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(docA);
// Insert text to the document start.
builder->MoveToDocumentStart();
builder->Write(u"First Hello World paragraph");
auto docB = MakeObject<Document>(MyDir + u"Document.docx");
// Add document B to the and of document A, preserving document B formatting.
docA->AppendDocument(docB, ImportFormatMode::KeepSourceFormatting);
docA->Save(ArtifactsDir + u"HelloWorld.SimpleHelloWorld.pdf");
view raw hello-world.h hosted with ❤ by GitHub