function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
For ms-excel document having content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' , tryout this sample code given below :
List<Document> lstDoc = Database.query('SELECT d.Id, d.Name, d.Body, d.ContentType, d.IsPublic, d.FolderId FROM Document d WHERE d.Name Like \'' + Userinfo.getUserName() + '%\'');
if(propFileBody != null && propFileName != null && propContentType != null && propContentType != '')
{
if(lstDoc != null && lstDoc.size() > 0 && (lstDoc[0].ContentType == 'image/png' || lstDoc[0].ContentType == 'image/x-png' || lstDoc[0].ContentType == 'image/pjpeg' || lstDoc[0].ContentType == 'image/jpeg' || lstDoc[0].ContentType == 'image/gif' || lstDoc[0].ContentType == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')) //Update Record
lstDoc[0].Name = Userinfo.getUserName();
lstDoc[0].Body = propFileBody;
lstDoc[0].ContentType = propContentType;
lstDoc[0].Type = propContentType.substring((propContentType.indexOf('/')+1),propContentType.length());
system.debug('Updated*********');
Database.SaveResult sr = Database.Update(lstDoc[0]);
}
Hope this helps.
For ms-excel document having content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' , tryout this sample code given below :
List<Document> lstDoc = Database.query('SELECT d.Id, d.Name, d.Body, d.ContentType, d.IsPublic, d.FolderId FROM Document d WHERE d.Name Like \'' + Userinfo.getUserName() + '%\'');
if(propFileBody != null && propFileName != null && propContentType != null && propContentType != '')
{
if(lstDoc != null && lstDoc.size() > 0 && (lstDoc[0].ContentType == 'image/png' || lstDoc[0].ContentType == 'image/x-png' || lstDoc[0].ContentType == 'image/pjpeg' || lstDoc[0].ContentType == 'image/jpeg' || lstDoc[0].ContentType == 'image/gif' || lstDoc[0].ContentType == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')) //Update Record
{
lstDoc[0].Name = Userinfo.getUserName();
lstDoc[0].Body = propFileBody;
lstDoc[0].ContentType = propContentType;
lstDoc[0].Type = propContentType.substring((propContentType.indexOf('/')+1),propContentType.length());
system.debug('Updated*********');
Database.SaveResult sr = Database.Update(lstDoc[0]);
}
}
Hope this helps.