Al usar Aspose.Total for C++ puede analizar JSON a PCL dentro de sus aplicaciones C++ en dos simples pasos. En primer lugar, al usar Aspose.Cells for C++ , puede exportar JSON a PDF. Después de eso, usando Aspose.Words for C++ , puede convertir PDF a PCL.
Convierta el formato JSON a PCL en C++
Requisitos de conversión
Instale a través de Package Manager Console de Visual Studio con Install-Package Aspose.Total.Cpp
.
Como alternativa, obtenga el instalador MSI sin conexión o las DLL en un archivo ZIP desde descargas .
// 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"); |
Establecer diseño y convertir formato JSON a PCL en C++
Mientras analiza JSON a PCL, también puede establecer el tamaño de las filas y columnas cargando JSON con la clase IWorkbook . Si necesita establecer el mismo alto de fila para todas las filas de la hoja de cálculo, puede hacerlo mediante SetStandardHeight método de la colección ICells . De manera similar, para establecer el mismo ancho de columna para todas las columnas de la hoja de cálculo, utilice el método SetStandardWidth de la colección 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"); |
Convierta el formato JSON a PCL con marca de agua en C++
Usando la API, también puede analizar JSON a PCL con marca de agua. Para agregar una marca de agua a su documento PCL, primero puede convertir JSON a PDF y agregarle una marca de agua. Para agregar una marca de agua, cargue el archivo PDF recién creado usando la clase Document , establezca diferentes propiedades para la marca de agua de texto, llame al método SetText y pase el texto y el objeto de la marca de agua de TextWatermarkOptions. Después de agregar la marca de agua, puede guardar el documento en PCL.
// 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"); | |