Utf-8 format


#1

hi team

utf-8 format is not working .

for some reports it is working. some other reports it is not working
code:
com.aspose.cells.Workbook wb = new Workbook();
wb.getOpenOptions().setEncoding(“UTF-8”);
wb.open(“C:\Documents and Settings\rgendhe.EISHCPU00061\Desktop\check\1008212_8939_1.csv”);

wb.getSaveOptions().setEncoding(“UTF-8”);
wb.save(“C:\Documents and Settings\rgendhe.EISHCPU00061\Desktop\check\output1.xlsx”, com.aspose.cells.FileFormatType.XLSX);

please find the attached files. i mentioned which are working which are not working.

any help on this will be appreciated.


#2

Hi,

Thanks for your posting and files.

Can you please let us know which version of Aspose.Cells for Java, you are using? We have fixed such an issue in newer versions. So please check your issue on latest Aspose Cells for Java
v2.5.2.8


Please also read this Note


#3

hi faiz

we are using cells for java 2.5.2.8. there is no change in output.
please check the output files once.

thanks & regards
ranjith kumar






#4
Hi,

I am afraid the csv file "(INPUT+FOR+OUTPUT.XLSX)1008404_3617_1.csv" is not an UTF-8 format file in fact. To confirm this, please open this file by notepad and try to re-save it as another file, the default format is not "UTF-8" but "ASCII". However, for your another csv file "(INPUT+FOR+OUTPUT1.XLSX)1008212_8939_1.csv", notepad will give "UTF-8" as its default format.

#5

hi raza

i did not check the format. the first one is not in utf-8 format.
thanks for your reply.

if it is not in utf-8 format we need to convert to utf-8 format. is there any chances.
we did not handle the conversions in csv file generation.

thanks & regards

ranjith.


#6

Hi,

The original content has been corrupted when generating the csv file and cannot be recovered from this csv file. You will have to re-create the csv file again with the original data and proper encoding.


#7

Hi @shakeel.faiz

I am using the following code to convert excel to pdf. But the result I got is a faulty pdf file font.
Can you help me solve it?
I’m using aspose-cells

public static void convert2PDF(String excelPath, String pdfPath) {
if (!getLicense()) {
return;
}
try {

		Workbook wb = new Workbook(excelPath);

		FileOutputStream fileOS = new FileOutputStream(new File(pdfPath));
		wb.save(fileOS,com.aspose.cells.SaveFormat.PDF);
	
		fileOS.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
}

private static boolean getLicense() {
	boolean result = false;
	try {
		InputStream is = FileDownload.class.getClassLoader()
				.getResourceAsStream("license.xml"); 
		License aposeLic = new License();
		aposeLic.setLicense(is);
		result = true;
	} catch (Exception e) {
		e.printStackTrace();
	}
	return result;
}

#8

@HaiHung,

Thanks for the sample code segment.

Please provide us your template Excel file, we will check your soon.


#9

forum The forum does not allow me to upload excel files. Can you give me your email?


#10

@HaiHung,

Please zip the files and attach it here.


#11

aspose-test.zip (7.6 KB)
Please help me!


#12

@HaiHung,

Thank you for your query.

We have checked the sample file latest version Aspose.Cells for Java 18.6.5 and observed that “Times New Roman 12” is changed to “Calibri (Body) 11”. Is this the problem are you facing or is there some other issue? Please explain type of issue you are facing along with the snapshots.


#13

For security reasons, can I send files and images via email to you?


#14

@HaiHung

You may share the data in a private message: you can click on my name and find “Message” Button, in order to send a private message. We will check your issue soon.


#15

I received the notice :“Sorry, you cannot send a personal message to that user.”
I have an excel file on my server, and I want to convert it to pdf format.
But I encountered a small trouble that is after the conversion, my pdf file content is faulty font.
Here is my excel file:
test120180709172317.zip (12.4 KB)
And here is the code that I use to convert excel to pdf:

/* String excelPath is my excel file store /
/
String pdfPathis my pdffile store */

public static void convert2PDF(String excelPath, String pdfPath) {
if (!getLicense()) {
return;
}
try {

	Workbook wb = new Workbook(excelPath);

	FileOutputStream fileOS = new FileOutputStream(new File(pdfPath));
	wb.save(fileOS,com.aspose.cells.SaveFormat.PDF);

	fileOS.close();
} catch (Exception e) {
	e.printStackTrace();
}

}

private static boolean getLicense() {
boolean result = false;
try {
InputStream is = FileDownload.class.getClassLoader()
.getResourceAsStream(“license.xml”);
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}


#16

@HaiHung,

I have tested the sample code with your sample XLSX file and created a PDF file. The output PDF file and a comparison image showing both the input Excel file and the output PDF file is attached with this post. Please review it and identify the issue in the attached image.

Comparison.PNG (199.9 KB)
test120180709172317_18.6.5.pdf (83.1 KB)


#17

I can not download your file on the forum
“Sorry, this file is private. Only visible to topic owner and staff members.”
Can I send these two files to me via email "kingdoanh24@gmail.com"?


#18

@HaiHung,

It seems that you are not logged in properly or logged in with some other user than the user who created this thread because these errors are normally displayed in these cases.

For you convenience please download files from the following link.
Sample Data


#19

Oh, so why every time I save the pdf file to serve is a font error!
I fixed this by saving the .excel file directly to the server, and I found it was ok! I do not know why ?


#20

@HaiHung

Please create a sample application replicating this behavior so that we can investigate it to help you.