Voila.....finally its working.....:-)
After googling for hours together finally found the appropriate codes/links
my requirement is quite simple (???)
update/edit the excel files in my document library programatically. Sounds simple.....huh?
The real problems occur when we start working towards the requirement.
problem 1. Server will not have excel dlls to work with.
problem 2. Jet/ACE drivers giving lot of error while using (using OLEDB)
Problem 3. Cannot trust third party dlls
Finally microsoft/other sites shed some light on how to use Open XML for this scenario.
http://howtosharepoint.blogspot.com/2010/05/programmatically-edit-and-save-file.html
http://msdn.microsoft.com/en-us/library/ee956524.aspx
I've created one class with the methods given in Open XML.
Created one method as below
public static MemoryStream UpdateMe2(MemoryStream memStr, string sheetName, string strCellName, string strVal)
{
using (SpreadsheetDocument document = SpreadsheetDocument.Open(memStr, true))
{
WorkbookPart wbPart = document.WorkbookPart;
UpdateValue(wbPart, sheetName, strCellName, strVal, 0, true);
return memStr;
}
return null;
}
After googling for hours together finally found the appropriate codes/links
my requirement is quite simple (???)
update/edit the excel files in my document library programatically. Sounds simple.....huh?
The real problems occur when we start working towards the requirement.
problem 1. Server will not have excel dlls to work with.
problem 2. Jet/ACE drivers giving lot of error while using (using OLEDB)
Problem 3. Cannot trust third party dlls
Finally microsoft/other sites shed some light on how to use Open XML for this scenario.
http://howtosharepoint.blogspot.com/2010/05/programmatically-edit-and-save-file.html
http://msdn.microsoft.com/en-us/library/ee956524.aspx
I've created one class with the methods given in Open XML.
Created one method as below
public static MemoryStream UpdateMe2(MemoryStream memStr, string sheetName, string strCellName, string strVal)
{
using (SpreadsheetDocument document = SpreadsheetDocument.Open(memStr, true))
{
WorkbookPart wbPart = document.WorkbookPart;
UpdateValue(wbPart, sheetName, strCellName, strVal, 0, true);
return memStr;
}
return null;
}