I'm sending an email via scheduler class with an excel file as an attachment, but the data in the file does not appear to be in proper format. Please check the following image:
The code I'm using to generate the file:
enter code here
private static void sendMailWithAttachment() {
String subject = 'excel file subject';
String body = 'excel file body';
Messaging.SingleEmailMessage emailMessage = new Messaging.SingleEmailMessage();
emailMessage.subject = subject;
emailMessage.plaintextbody = body;
Messaging.EmailFileAttachment excelAttachment = new Messaging.EmailFileAttachment();
excelAttachment.setFileName('excel_report' + '.xls');
excelAttachment.setBody(reportPage.getContent());
excelAttachment.setContentType('application/vnd.ms-excel');
List<Messaging.EmailFileAttachment> attachments = new List<Messaging.EmailFileAttachment>();
attachments.add(excelAttachment);
emailMessage.setFileAttachments(attachments);
Messaging.sendEmail(emailMessage);
}
1.23457E+14 is not a proper format.
How to fix the format of the number through apex?