Posts

Showing posts from December, 2011

Workaround: Blank document property has value [fieldname] in Word (SharePoint Document Library)

In one of my SharePoint project which involved SharePoint Workflow to create new document by values entered in SharePoint list which gets copied to SharePoint document library and in turn generate document with the values, these values  are visible as quick part in document property pane.  Following steps are performed on SharePoint part: ·           A document library which has a Word document associated which is used as the basis for all new documents ·           A list containing the fields that we want to pass into a new document ·           A workflow which creates a new Word document and copies the fields from the list into the document The problem which I had been facing is that the 'Quick Parts' in word document is showing by default 'Quick Part' name even when the value was not being entered. So to resolve this issue here is the workaround :- in Word 2007, click the "Developer" tab, then "Design Mode" button.  After that, remove

Exporting DataTable To Excel using ASP.NET

In continuation to my previous post which addressed Export to Excel issue in ASP.NET ( click here ), here is another post which is a solution for Exporting a DataTable to Excel using ASP.NET. Many times we come across scenario where we don't need to show the grid and just export data which is available in DataTable to Excel. You can use following method by passing the DataTable as parameter, which in turn export the data to Excel. I have implemented with AJAX also without any issue. Note: While using AJAX on a button click, do not forget to Add a PostBackTrigger to your UpdatePanel that points at the button, otherwise it will give "Sys.WebForms.PageRequestManagerParserErrorException"  Exception because of violation of using Response.Write bypasses the normal rendering of ASP.NET control. private void ExportGridToExcel(DataTable dt) {         StringWriter strwriter = new StringWriter();         HtmlTextWriter htmlwriter = new HtmlTextWriter(strwriter);