Office automation export Excel as pdf

  private void saveBarButtonItem_ItemClick(object sender, ItemClickEventArgs e) { _pdfFilePath = Path.GetDirectoryName(_filePath) + "\\" + Path.GetFileNameWithoutExtension(_filePath) + ".pdf"; if (File.Exists(_pdfFilePath)) File.Delete(_pdfFilePath);   object pdfFilePath = _pdfFilePath; object oMissing = Missing.Value; object fileFormat = Excel.XlFileFormat.xlOpenXMLWorkbook; _excelDocument.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF, pdfFilePath, Excel.XlFixedFormatQuality.xlQualityStandard, true, true, 1, 10, false); PdfFilePath = PdfFilePath; _excelDocument.Close(oMissing, oMissing, oMissing); releaseObject(_excelDocument); DialogResult = DialogResult.OK; }   private void […]

My first day to start Behaviour Driven Development (BDD) with MSpec and MVC.

My first day to start Behaviour Driven Development (BDD) with MSpec. After discussion within development we decided to go for Machine.Specifications (or MSpec for short) I used NuGet Package to install MSpec and I searched with word mspec but found nothing then searched with word Machine and found the mspec package (Machine.Specifications). I installed it. […] mvc combine url dynamically c#

I was working to send a password re-set email to user and wanted to to create a URL dynamically i.e It should be including the http or https and wwww and domain name and application name and then the URL defined by my self. I created as follow which seems very clean way to do […]

Jquery Mobile development mvc 3 page layout

My first step to start developing mvc3 mobile website. I have created a website useing mvc3 . I started writing mobile version of my website. Obviously google was the place to start and alos one of my friend mentioned JQuery mobile to me. After spending some time on how and where to start I found […]

Access iFrame element from parent page using jquery

To access an iFrame element from its parent page we can use following JQuery function. $(’#frmiFrameTest’).contents().find("[id*=element-id]") frmIframeTest= Iframe Id   element-id = Id of element in iFrame.      

Apply CSS Style to the parent page based on condition in an IFrame content.

I was given asn assignment to change theb back ground image of the parent page for a pop up window which as being opened using JQuery color box pluging. The pop up page was being opened in an iFrame (html tag). In Iframe we had a div with the Id and also we had the […]

Regular expression for UK-Mobile numbers with optional country code and spaces in number

Recently I was given a problem that UK Mobile phone numbers with spaces in the number are not being accepted by application as its convenient to write numbers like (+44 0791 452 1234 OR “0791 452 1234”) instead  (+447914521234  OR  07914521234) (dummy number used for illustration purpose only). UK mobile numbers are of 11 digit […]

How to generate XML website map for free using IIS

How to generate XML website map for free using IIS If you want to create a sitemap for your website, it’s very very easy and free of cost. You can do it in your own time at your own computer. So as it’s on your computer its your property and you can play with it […]

ASP.NET MVC EditorFor css Solution

A Quick solution when trying to format a textbox with CSS, and currency format is a bit tricky in ASP.NET MVC You can’t put CSS on a Html.EditorFor like you can on a TextBoxFor like so <%= Html.TextBoxFor(x => x.CostPrice, new { @class = “textShort”, maxlength = “50” })%> And you cant put a tag […]

debugging website hosted on IIS web server from visual studio

Often you want to debug a website hosted in IIS from your visal studio. Requirement: Visual Studio, Website (you want to debug) must have the same source code. Now web browser (Internet explorer, Firefox , Google chrome etc) type the URL of your website hosted in IIS (Internet Infomration Server). Open the Source code in […]