Utilizzando Aspose.Total for C++ puoi analizzare JSON in EPUB all’interno delle tue applicazioni C++ in due semplici passaggi. Innanzitutto, utilizzando Aspose.Cells for C++ , puoi esportare JSON in PDF. Successivamente, utilizzando Aspose.Words for C++ , puoi convertire PDF in EPUB.
Converti il formato JSON in EPUB in C++
Requisiti di conversione
Installa tramite Package Manager Console di Visual Studio con Install-Package Aspose.Total.Cpp
.
In alternativa, scarica il programma di installazione MSI offline o le DLL in un file ZIP da downloads .
// Load the JSON. | |
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"sourceFile.json"); | |
// Save in PDF format. | |
wkb->Save(u"convertedFile.pdf", SaveFormat_Pdf); | |
// Load the PDF. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"sourceFile.pdf"); | |
// supports DOC, DOT, DOCM, DOTX, DOTX, FLATOPC, RTF, WordML, MOBI, CHM, ODT, OTT, PS, PCL, EPUB file formats | |
// Save in DOC format. | |
doc->Save(u"convertedFile.doc"); |
Imposta layout e converti formato JSON in EPUB in C++
Durante l’analisi da JSON a EPUB, puoi anche impostare la dimensione di righe e colonne caricando JSON con la classe IWorkbook . Se è necessario impostare la stessa altezza di riga per tutte le righe del foglio di lavoro, è possibile farlo utilizzando SetStandardHeight metodo della raccolta ICells . Allo stesso modo, per impostare la stessa larghezza di colonna per tutte le colonne del foglio di lavoro, utilizzare il metodo SetStandardWidth della raccolta ICells.
// Load the JSON. | |
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"sourceFile.json"); | |
// accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// setting the height of all rows in the worksheet to 25 | |
worksheet->GetICells()->SetStandardHeight(25); | |
//Setting the width of all columns in the worksheet to 20.5 | |
worksheet->GetICells()->SetStandardWidth(20.5); | |
// save in PDF format. | |
wkb->Save(u"convertedFile.pdf", SaveFormat_Pdf); | |
// Load the PDF. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"sourceFile.pdf"); | |
// supports DOC, DOT, DOCM, DOTX, DOTX, FLATOPC, RTF, WordML, MOBI, CHM, ODT, OTT, PS, PCL, EPUB file formats | |
// Save in DOC format. | |
doc->Save(u"convertedFile.doc"); |
Converti il formato JSON in EPUB con Watermark in C++
Utilizzando l’API, puoi anche analizzare JSON in EPUB con filigrana. Per aggiungere una filigrana al tuo documento EPUB, puoi prima convertire JSON in PDF e aggiungervi una filigrana. Per aggiungere una filigrana, caricare il file PDF appena creato utilizzando la classe Document , impostare proprietà diverse per la filigrana di testo, chiama il metodo SetText e passa il testo e l’oggetto della filigrana di TextWatermarkOptions. Dopo aver aggiunto la filigrana, è possibile salvare il documento in EPUB.
// Load the JSON. | |
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"sourceFile.json"); | |
// Save in PDF format. | |
wkb->Save(u"convertedFile.pdf", SaveFormat_Pdf); | |
// Load the PDF. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"sourceFile.pdf"); | |
// Set different properties for text watermark | |
auto options = System::MakeObject<TextWatermarkOptions>(); | |
options->set_FontFamily(u"Arial"); | |
options->set_FontSize(36); | |
options->set_Color(System::Drawing::Color::get_Black()); | |
options->set_Layout(WatermarkLayout::Horizontal); | |
options->set_IsSemitrasparent(false); | |
// Set text for the watermark | |
docx->get_Watermark()->SetText(u"Test", options); | |
// supports DOC, DOT, DOCM, DOTX, DOTX, FLATOPC, RTF, WordML, MOBI, CHM, ODT, OTT, PS, PCL, EPUB file formats | |
// Save in DOC format. | |
doc->Save(u"convertedFile.doc"); | |