Wrong fonts and wrong autofit when using Syncfusion's ExcelToPdfConverter - excel

I am currently using Syncfusion's ExcelToPdfConverter to convert an XLSX document to a PDF.
I first create the XLSX document and then convert it to PDF with the following code:
var converter = new ExcelToPdfConverter(workbook);
//Intialize the PDFDocument
var pdfDoc = new PdfDocument();
//Intialize the ExcelToPdfconverterSettings
var settings = new ExcelToPdfConverterSettings();
//Assign the PDFDocument to the TemplateDocument property of ExcelToPdfConverterSettings
settings.TemplateDocument = pdfDoc;
settings.EmbedFonts = true;
//Convert Excel Document into PDF document
pdfDoc = converter.Convert(settings);
//Save the pdf file
pdfDoc.Save(PDFFullPath);
The resulting XLSX is correct and it looks like it should.
The converted PDF isn't correct though. It's just like it's using wrong fonts and, as a consequence, those rows that have been autofitted with AutofitRow get truncated.
Has anyone else had this issue before?
Is there any way to tell the PDFConverter to use the correct fonts? (Please note that I'm using Arial and Calibri and they're both installed in the system's fonts)
Regards.

We suspect that the issue might occur due to the assignment of wrong row index. In XlsIO, the Row and Column indexes are one based.
Kindly refer below documentation to know more about AutofitRow and AutofitColumn.
Documentation Link: https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation#auto-fit-a-single-row-or-column
Regards,
Abirami.

This was actually a bug in Syncfusion XlsIO that has been fixed in a patch due out in February 2017.
The above code is correct.

Related

Not able to download Suitelet through suitescript 1.0

I have created a button to export the form data to simple Excel.
Everything is working file, even if i try to save this excel file in the file cabinet it gets saved correctly.
But when i try to downlaod the excel file, downloads wierd single cell file with special characters or system gives either an error or saves an empty excel file.
Can anyone help me in how to download the excel file from button click. I think i have issue in my responce.
My Code example is as follows:
.
.
.
xmlString += '</Table></Worksheet></Workbook>';// this is my xml string
var xlsFile = nlapiCreateFile('test.xls', 'EXCEL', nlapiEncrypt(xmlString, 'base64'));
response.writeFile(xmlFile);
}
error screenshot:
I think the reason for the response issue is because you are calling a non-existent variable "xmlFile" in writeFile();
try using this writeFile(xlsFile);

MetadataExtractor File format could not be determined

I'm using metadataExtractor (v.2.7.1) in .Net Core (3.0.1) to get the date of the photos.
var file = Request.Form.Files[0];
try
{
IEnumerable<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(file.OpenReadStream());
....
}
And I get sometimes this exception on this line "File format could not be determined"
Any idea what is wrong? This photo seems to be correct and having the exif metadata I need.
The code is working for other photos.
Thank you in advance
The problem was that this photo was larger than the other one and was uploaded in chunck. I was trying to get EXIF from each chunk, which is not possible...

Reading xls file is returning html tags using library xlsx

I am using xlsx library of nodejs for reading xls file. According to the document the library supports xls file format. On reading I am getting html tags along with it.
I can remove the html tags using regex or replace function but does the library give support to do that as I couldn't find it in the documentation?
Excel File format: Microsoft Excel 97-2003 Worksheet (.xls)
The demo link they have provided in their documentation https://oss.sheetjs.com/sheetjs/ works but when I try to do the same with my code it doesn't give the desired result.
let xlsx = require('xlsx');
let fs = require('fs');
let workBookData = xlsx.readFile('data.xls'); // parses a file
console.log(workBookData);
Here is an image of the result I am getting.
This was an issue/bug in the library. A PR has been created for this and it will be fixed in the new version of the library.

Cannot Retrieve Data from Excel File Created using Aspose.Cells

I create an Excel file (.xlsx) using the Aspose.Cells library. But I'm not able to read the data (retrieve rows) using OleDb commands after that, until I open the file and save it manually. I'm running something as simple as this one:
new OleDbDataAdapter("select * from [Sheet1$]", conn); // etc...
Saving the file increases the size of the file as well. Please note that this happens only with the .xlsx format, for the old .xls everything works fine. I even tried the demo code that they have on their website, but the result is the same. Am I missing something?
It seems you need to set the ExportCellName name property to true before saving to xlsx/xlsm format.
Please see the following sample.
//Create your workbook
Workbook workbook = new Workbook(filePath);
//Do your processing
//Save your workbook with export cell as true
OoxmlSaveOptions opts = new OoxmlSaveOptions();
opts.ExportCellName = true;
workbook.Save("output.xlsx", opts);
Note: I am working as Developer Evangelist at Aspose

SharePoint and Office Open XML interaction question

I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.
I'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file back. I've gotten all but the last part of this down. The reason Office Open XML is involved is that that's how I'm opening the document and modifying it - through the Office Open XML SDK. My question is: How do I get it from the document back into the library?
The problem as I see it is that there's no save function on the WordprocessingDocument object itself. This prevents me from saving it into the SPFile's SaveBinary function.
You should use stream's to write back the changed OOXML into the SPFile.
I hope this example helps!
Stream fs = mySPFile.OpenBinaryStream();
using (WordprocessingDocument ooxmlDoc = WordprocessingDocument.Open(fs, true))
{
MainDocumentPart mainPart = wordDoc.MainDocumentPart;
XmlDocument xmlMainDocument = new XmlDocument();
xmlMainDocument.Load(mainPart.GetStream());
// change the contents of the ooxmlDoc / xmlMainDocument
Stream stream = mainPart.GetStream(FileMode.Open, FileAccess.ReadWrite);
xmlMainDocument.Save(stream);
// the stream should not be longer than the DocumentPart
stream.SetLength(stream.Position);
}
mySPFile.SaveBinary(fs);
fs.Dispose();
Yesterday I saw a webcast with Andrew Connell where he opened a doc from a doc library, added a watermark and saved the file again. It sure sounds like you should have a look at that webcast:
https://msevents.microsoft.com/CUI/WebCastRegistrationConfirmation.aspx?culture=en-US&RegistrationID=1299758384&Validate=false
btw I found that all 10 of the web casts in that serie were very good.

Resources