.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

displaying the html table as a pdf document

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :ASP.Net
well the question is simple but i searched all over, found crystal reports found many toolsbut the problem isi cannot use an other tools, or libraries other then the default with vs08 sp1i cannot use crystal reports, as its datasource is dataset or xml none of which is theremy page on users click of button generates a html table and info within using c# code behind (i.e. at runtime) so how to write this stream to browser such that it becomes a valid pdf file?

View Complete Post

More Related Resource Links

Regular Expression to Match


Here is the kind of text I want to match via a regular Expression

The id="dgSchedule" is always present in the TAG but its location may differ

The table is span over multiple line/contains white spaces/tabs...

I have the regular expression to match the start and end tag respectively over a single line

\<table .*\>


The problem is to match the whole table span over multiple lines

<table cellspacing="0" rules="all" border="1" id="dgSchedule" style="border-style:None;height:100%;width:100%;border-collapse:collapse;">
	<tr class="blackbar" align="center" style="background-color:#7FB4DE;font-family:Verdana;font-weight:bold;height:20px;">
		<td>From Place</td><td>To Place</td><td>Time</td><td>Bus Type</td>

	</tr><tr style="background-color:#DEECF5;">
	</tr><tr style="background-color:#EFF5FA;">
	</tr><tr style="background-color:#DEECF5;">


HTML Table Disable


I have a HTML Table that I use to place the control in so they display nicely on my Web Form.  I also use the Disable method to keep unwanted users from editing those controls based on their log in information, however I still want the information to be displayed for their review.

The information is displayed for example in the Text Boxes, however when they hit Enter on the form because the table is disabled for some reason the information is lost when I do my update to the SQL Server (the text box shows "")?

Why is it I can see the information on the screen, but the text box shows empty when hitting enter on the form?



Change grid view from table to other HTML layout



You'll have to excuse my ignorance, I'm coming at this from a front-end perspective, and don't really know how to deal with data views in ASP.NET.

Basically, I'm trying to change the layout of some repeated data from a straight table, to something more design-heavy.  It's the same data, just re-organised slightly.  The current ASP.NET code looks like this:

                    <asp:GridView ID="GVMoments" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" PageSize="20" RowHeaderColumn="FirstName"
                        SkinID="GroupSkin" DataKeyNames="moment_id" 
                        <PagerSettings Mode="NumericFirstLast" PageButtonCount="20" Position="TopAndBottom" />
                        <RowStyle />
                                <asp:BoundField DataField="moment_id" HeaderText="moment_id" ReadOnly="True" SortExpression="moment_id"
                                    Visible="False" In

Model Binding the values in an HTML Table back to Controller / Model


Currently, I am working with ASP.NET MVC1 and am still learning about Model Binding and how values from a View are passed back to the Controller / Model. Specifically, I want take an existing Model, create a Table and populate the Rows of the Table, allow the user to edit some fields and pass it back.

In my example, I have a Class called "Ingredient" which has 4 public accessors:  Name, Barcode, Amount, and Unit

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcACE.DomainModel.Entities.Ingredient>>" %>

<% using (Html.BeginForm("SubmitOrder","MyController"))
{ %>

<% if (Model != null)
foreach (var item in Model)
{ %>
<td><%= Html.Encode(item.Name)%></td>
<td><%= Html.Encode(item.Barcode)%></

blank row in HTML table?


 is there any way to inset a couple of blank rows into an html table, or do I need to create a separate <table> with a couple of <br> in between?

Help creating HTML table from dataTable when every nth dataTable row = 1 html table row... C#

Hello, Im trying to create an html table from data that is in a dataTable but Im having trouble coming up with the right logic. Every 3 rows in the dataTable needs to be 1 row in the html table.  Ive tried using foreach through the datatable with a modulus to determin every third dataTable row but i still run into snags because i am building the table using objects rather than using concatenated strings..(example TableRow tr = new TableRow  etc...). I cant add the cells to the rows when the row is only created in an if statement etc. Can someone post a good example in c# of how they would achieve this. The amount of data in the dataTable could change from time to time so the code cant rely on a pre determined size, unless you just need the total rows and columns, that can be dtermined when the dataTable is filled from the sqlDataReader. <table><tr><td>dataTable row 1 values</td><td>ataTable row 2 values</td><td>dataTable row 3 values</td></tr> <tr><td>dataTable row 4 values</td><td>dataTable row 5 values</td><td>dataTable row 6 values</td></tr>   Any help and example would be great. Ive been able to do similar tables in other apps but thats only when I use concatenated text strings to build the html table. Im trying to stay away from that this time

Problem displaying Date from Sql table on Calendar Control

Hi, I am displaying Event dates from SQL table on Calendar Control in ASP.NET. Also, I have GridView Control which shows event details when certain date is clicked on calendar control. But I have a problem as not all dates are displaying properly. Strangly enough only dates which have same month and day date are displayed. For example: It shows ok dates such as 08/08/2010, 09/09/2010, 10/10/2010 etc. If I click on the date which in SQL table exists as 11/25/2010 or 12/15/2010 etc (no matching month/day numbers) it shows error message saying: "System.Data.SqlClient.SqlException: Conversion failed when converting date and/or time from character string."  Follwoing is my code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql; using System.Runtime.Remoting.Messaging; using System.Configuration; using System.Data.SqlClient; using System.Data; using System.Drawing; public partial class Test_Calendar : System.Web.UI.Page { SqlConnection mycn; SqlDataAdapter myda; DataSet ds = new DataSet(); DataSet dsSelDate; String strConn; private void Page_Load(object sender, System.EventArgs e) { strConn = "Data Source=mydatasource;Initial Catalog=DBname;Persist Security I

Trying to include version history table inside Word document

Running MOSS 2007 with SP1, Office 2007.   I'm trying to create a table (doesn't have to be a table though) of a document's version history inside the document. This would be the history information kept by SharePoint. Since we can't even easily get just the current version number into the document I'm having problems and thought I'd see if anybody has a bright idea.   First, a couple facts. From Word 2007 it is possible to view the Document Library version information by clicking on the Office Button > Server > View Version History. This brings up the following: Click for screenshot   My goal is to get that version information displayed IN the document so when it is printed there is a document history. I tried using IRM label policies, but this only displays the current version and you can't include the comments.   After some digging I found the following code sample on MSDN:   Code SnippetDim dlvVersions As Office.DocumentLibraryVersions    Dim dlvVersion As Office.DocumentLibraryVersion    Dim strVersionInfo As String    Set dlvVersions = ActiveDocument.DocumentLibraryVersions    If dlvVersions.IsVersioningEnabled Then        strVersionInfo = "This document has " & dlvVersions.Count & " versions: " & vbCrLf        For Each dlvVersion In dlvVersions            strVersionInfo = strVersionInfo & _                " - Versi

Insert html formatted text into word document asp.net(C#)

HI,I am creating an ms-word document from server side using a template. Here i add the reference Microsoft word 11.0 object library. Here i use a template where i set some bookmarks. Now i need to populate those bookmarks.Everything goes fine but i am stuck in one place where i need to write html text exceptnormal text. My code sample is as follows:            object TemplatefileName = Server.MapPath("Template") + "\\High.doc";            object novalue = System.Reflection.Missing.Value;            Word.Table oTable;             Word.ApplicationClass objWord = new Word.ApplicationClass();            Word.Document objWordDoc = objWord.Documents.Add(ref TemplatefileName, ref novalue, ref novalue, ref novalue);            objWordDoc.Activate();            objWordDoc.Application.Visible = true;   objWordDoc.Bookmarks.get_Item(ref prj_name).Range.Text = dProject.Rows[0]["txtProject"].ToString();Here its a complex report. Now in a bookmark i need to write html c

data from html table to datareader to excel

helloi have to collect data from a website which is in table format, i have to put the table row into specific row and colum in excel, can anyone tell me how do i do itfor examplehttp://www.bizrate.com/ratings_guide/merchant_detail__mid--44084.htmlit has rating so how can i put those rating into any kind of database or excel??i want to pass the url and it should scan and filter it.can anyone tell me how this can be done. thnks in advance

Search results are not displaying the results related to a particular document library


While using the search box in a site, the search results are not displaying the results related to a particular document library.

What is the reason for this? How can this be solved?

How to prevent HtmlEditor from displaying html tags within editor?


I'm using the ajaxcontroltoolkit htmleditor to create blog posts for my website.  The editor works fine when entering a new article.  When I click the Bold button, the text appears bold.  When I hit enter, the editor creates a new line, etc.  However, I also use the htmleditor when I want to edit a preexisting article.  The problem I'm receiving, is when I bring a preexisting article into the editor, it displays a mess of html tags rather than the clean, formatted text.

For example, if I type the following into the editor:


Hello World

How are you?


...when I go to edit it, it shall appear as:


<span style="font-weight: bold">Hello World</span><br /> <br />How are you?


Is there any way to force the editor to display this text properly when editting rather than showing the html tags?


Table formatting in word document using C#.net


I need to form my word document(#30 pages) like this using c#.net:
A   C
B   D
E   F
G   H
I   J
K   L

Here A,B,C,D...  are the text paragraphs and the page should split into two columns and if table comes it should come in one colume.
Please can one help me in this regard.

Embedded HTML using
to replace tags in ssrs 2008   

After doing various amounts of research and testing I need to post a question here. 

I am using an html editor to format html and data (for reports) and then using reporting services to render the html harnessing the report server to view, export, and print. 

As already many of you know around here you can set an ssrs table cell to “HTML – Interpret HTML tags as styles”.  Also many of you know that this functionality does not accept <table><tr><td></td></tr></table> tags.  However, the documentation says it support <div> tags. Yet when I try using div tags with the appropriate styles for creating tables this does not work either.  So if ssrs handles <div> tags could you please tell me a complete list of style attributes it handles as well?

Problem displaying a view correctly in MVC app using HTML.TextBoxFor() with VB



I have a test app with a form view.

I cannot get the view to display correctly instead of displaying a series to text boxes it displays quoted html.

I suspect that my problem is related to my VB syntax for my Linq

The C# equivilant works but my shop uses VB so I must convert the code.

Here is the code from the view:

      <% Using (Html.BeginForm)%>
          <p>Your name: <%: Html.TextBoxFor(Function(m) m.Name).ToString%></p>
          <p>Your email: <%: Html.TextBoxFor(Function(m) m.Email).ToString%></p>
          <p>Your phone: <%: Html.TextBoxFor(Function(m) m.Phone).ToString%></p>
          <p>Will you attend? <br />
          <%  Dim slist As New Generic.List(Of SelectListItem)
          slist.Add(New SelectListItem With {.Text = "Yes", .Value = Boolean.TrueString})
          slist.Add(New SelectListItem With {.Text = "No", .Value = Boolean.FalseString})
       <%: Html.DropDownListFor(Function(m) m.WillAttend, slist, "Choose an option")%>
       <input type="submit" value="Submit RSVP" />
       <% End Using%>

Hide Html table according to User Group

in my site i would like to hide an html table for specific user group , how do i do that with out using Visual Studio environment and with out using c# code is there any way that it can be done like in JavaScript , need a clear picture ....

html table content at top


i have to column

and onr row

column second text alway align in center

i want that second cell align data at top of the cell.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend