I'm using the Aspose lib to convert a PDF file to Excel file, my code below:
using Aspose.Pdf;
public async Task convertPDFtoEXCEL(Document pdfFile, string root, string fileName)
{
// Initialize ExcelSaveOptions
ExcelSaveOptions opts = new ExcelSaveOptions();
// Set output Excel XLSX format
opts.Format = ExcelSaveOptions.ExcelFormat.XLSX;
// Minimize number of Worksheets
opts.MinimizeTheNumberOfWorksheets = true;
// Convert PDF to Excel output file
pdfFile.Save(root + fileName + ".xlsx", opts);
}
public async Task<int> Get()
{
int number = 0;
string root = "C:/Users/Downloads/";
string fileName = "myFile";
// load the PDF file
Document pdfFile = new Document(root + fileName + ".pdf");
// convert the PDF file to EXCEL
await convertPDFtoEXCEL(pdfFile, root, fileName);
// ...
return number;
}
When my code ran I got this error:
System.InvalidOperationException: 'A model description could not be created. Duplicate model name 'Element' was found for types 'Aspose.Pdf.Structure.Element' and 'Aspose.Pdf.LogicalStructure.Element'. Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.'
What is the problem, and how can I fix it?