You need to sign in to do that
Don't have an account?
marys pinda
Number line attached file
Is it possible to count the number of lines in an attached file in the email?
Thank you!
Thank you
Thank you!
Messaging.EmailFileAttachment csvPJ = new Messaging.EmailFileAttachment(); blob csvBlob = Blob.valueOf(contenuCSV); string csvNom = 'cases_fermes_'+Date.today().format()+'.csv'; csvPJ.setFileName(csvNom); csvPJ.setBody(csvBlob); Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage(); String[] adressMail = new list<string> {mailSouhaite}; String subject = 'Report - '+Date.today().format(); email.setSubject(subject); email.setToAddresses( adressMail ); email.setPlainTextBody('mail....'); email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvPJ}); Messaging.SendEmailResult [] envoyer = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});Somethig like: csvPJ.getLineNumber();
Thank you
I used the \n as you said and it worked ...
Thank you!
All Answers
Unfortunately, Messaging.EmailFileAttachment doesn't have any method specific to one that can count the number of lines in an attached file.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound_attachment.htm#apex_Messaging_EmailFileAttachment_methods
You might have to use some code to go through the complete content of the atachment and then populate the lines used.
You might have to look for "return" characters in your attachment text to count the number of lines.
Thanks,
Shashank
I used the \n as you said and it worked ...
Thank you!
You might have to look for "return" characters in your attachment text to count the number of lines.
Thanks,
Shashank