โซลูชันของเรามี API ที่เป็นอิสระจากแพลตฟอร์มที่มีประสิทธิภาพ ใช้ API เอกสาร Mail merge ของเราเพื่อพัฒนาซอฟต์แวร์ระดับสูงสำหรับแพลตฟอร์ม C++ นี่เป็นโซลูชันซอฟต์แวร์ที่ทรงพลังสำหรับการผสานเทมเพลตในรูปแบบ Word และ PDF และข้อมูลจากแหล่งข้อมูลที่กำหนดเอง และส่งออกผลลัพธ์เพิ่มเติมไปยัง DOCX, PDF, HTML และรูปแบบยอดนิยมอื่นๆ โดยใช้ C++
ไลบรารี C++ ที่รวดเร็วเพื่อดำเนินการจดหมายเวียนกับข้อมูล Excel
Mail Merge SDK ของเราช่วยให้คุณสร้างเทมเพลต Word ด้วยข้อมูลของคุณจากแผ่นงาน Excel ตาม Mail Merge API ของเรา คุณสามารถสร้างโซลูชันซอฟต์แวร์ของคุณเองโดยใช้ C++ ซึ่งช่วยให้คุณสร้างอีเมลอัตโนมัติจาก Excel และสร้างรายงานด้วยข้อมูล Excel
หากต้องการ Mail merge จาก Excel เป็น Word เพียงดำเนินการ Mail merge ใน C++ และส่งออกผลลัพธ์ไปยังรูปแบบ Word ที่รองรับ
ด้วย Mail merge API ที่มีประสิทธิภาพของเรา คุณสามารถสร้างเอกสารส่วนบุคคลใน C++ โดยใช้เพียงเทมเพลต Word Merge และข้อมูลจาก Excel
วิธีใช้ Mail merge จาก Excel:
ด้วย Mail merge API ที่มีความเที่ยงตรงสูงของเรา คุณยังสามารถดำเนินการ Mail merge กับ Google เอกสารได้อีกด้วย เพียงดาวน์โหลดข้อมูลที่จำเป็นในรูปแบบ Word และ Excel ตรวจสอบให้แน่ใจว่าเทมเพลต Word มีฟิลด์ผสาน และดำเนินการจดหมายเวียนใน C++ ซึ่งคล้ายกับอัลกอริทึมที่อธิบายไว้ในส่วนก่อนหน้า
หากต้องการลองใช้เครื่องมือเว็บ Mail merge อันทรงพลังนี้ ให้โหลดเทมเพลต Word ที่มีเขตข้อมูลผสานพิเศษและข้อมูลจาก Excel ที่แปลงแล้วตามที่อธิบายไว้ข้างต้น หลังจากเรียกใช้โค้ด ให้ส่งออกผลลัพธ์เป็นรูปแบบใดก็ได้โดยใช้ C++
ตัวอย่างต่อไปนี้แสดงวิธีการดำเนินการ Mail merge เพื่อสร้างเอกสาร Word ใน C++:
dotnet add package Aspose.Words.Cpp
สำเนา
using namespace Aspose::Words;
using namespace Aspose::Cells;
auto doc = MakeObject<Document>(u"Input1.docx");
auto workbook = Factory::CreateIWorkbook(new String("Input2.xlsx"));
auto worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0);
auto dataRange = worksheet->GetICells()->GetMaxDisplayIRange();
auto dataTable = worksheet->GetICells()->ExportArray(
0, 0, dataRange->GetRowCount(), dataRange->GetColumnCount());
auto customersDataSource = MakeObject<BaseOperations::CustomerMailMergeDataSource>(dataTable);
doc->get_MailMerge()->Execute(customersDataSource);
doc->Save(u"Output.docx");
class ExcelDataSource : public IMailMergeDataSource
{
public:
System::String convertCellsString(String cellsValue)
{
auto valCh = cellsValue.charValue();
auto convertedString = System::String(valCh);
String::deleteCharValue(valCh);
return convertedString;
}
System::String get_TableName() override
{
return nullptr;
}
CustomerMailMergeDataSource(
intrusive_ptr<Aspose::Cells::Systems::Array2D<Aspose::Cells::Systems::Object*>> data)
{
dataIn = data;
for (int i = 0; i < data->At(0)->GetLength(); i++) {
auto fieldName = data->GetValue(0, i)->ToString();
m.insert({ convertCellsString(fieldName), i });
i++;
}
mRecordIndex = 0;
}
bool GetValue(System::String fieldName, SharedPtr<System::Object>& fieldValue) override
{
auto value = dataIn->GetValue(mRecordIndex, m.at(fieldName))->ToString();
if (value == new String(""))
return false;
fieldValue = System::ObjectExt::Box<System::String>(convertCellsString(value));
return true;
}
bool MoveNext() override
{
mRecordIndex++;
return mRecordIndex < dataIn->GetLength();
}
SharedPtr<IMailMergeDataSource> GetChildDataSource(System::String tableName) override
{
return nullptr;
}
intrusive_ptr<Aspose::Cells::Systems::Array2D<Aspose::Cells::Systems::Object*>> dataIn;
std::unordered_map<System::String, int> m;
int mRecordIndex;
};
มีสามตัวเลือกในการติดตั้ง Aspose.Words for C++ ในสภาพแวดล้อมของนักพัฒนาซอฟต์แวร์ของคุณ โปรดเลือกหนึ่งรายการที่ตรงกับความต้องการของคุณและทำตามคำแนะนำทีละขั้นตอน:
คุณสามารถใช้ไลบรารี C++ นี้เพื่อพัฒนาซอฟต์แวร์บน Microsoft Windows, Linux และ macOS:
หากคุณพัฒนาซอฟต์แวร์สำหรับ Linux หรือ macOS โปรดตรวจสอบข้อมูลเกี่ยวกับการพึ่งพาไลบรารีเพิ่มเติม (แพ็คเกจโอเพ่นซอร์ส fontconfig และ mesa-glu) ในเอกสารประกอบผลิตภัณฑ์
คุณสามารถดำเนินการ Mail merge สำหรับรูปแบบไฟล์อื่นๆ ได้: