Web Forms :: Do Calculation In Exported Excel Using C#
Nov 25, 2012
I am exporting only two columns to the excel
"Amount" and "Out Of 10 Percent".
I will enter the amount in "Amount" column and "Out Of 10 Percent", i will display the 10 Percent of the amount
Say Amount Out Of 10 Percent
1000 100
100 10.
I can do the calculation in C# and i can able to export the content to excel as above.
My need is in the exported excel, if change the amount means i should able to get the corresponding amount in the next column.
(i.e) in the exported excel, if i edit the "Amount" ->1000 to 500 means the next column "Out Of 10 Percent" should change as 100 -> 50. I mean it should be auto calculated in the exported excel.
View 1 Replies
Similar Messages:
Sep 12, 2012
I have comma separated data on client side [Since my columns and rows are dynamic along with dynamic control inside it which are not accessible in backend due to viewstate issue of dynamic controls],
So I am passing CSV string to Web Method as and want to get Excel file out of it.
I tried following code but it is not exporting the file.
[System.Web.Services.WebMethod]
public static void CSV2Excel(string csv){
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=FileName.csv");
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.Write(csv);
HttpContext.Current.Response.End();
}
View 1 Replies
Aug 18, 2010
I would like to add a Title row to an exported File from a Rad Grid. How can I do this?
<telerik:RadGrid ID="RadGridHist" runat="server" DataSourceID="SqlDataSourceHist" Visible="false"
AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" OnPageIndexChanged="RadGridHist_PageIndexChanged"
OnPageSizeChanged="RadGridHist_PageSizeChanged" OnItemCommand="RadGridHist_ItemCommand" OnSortCommand="RadGridHist_SortCommand"
[Code].....
View 1 Replies
Nov 4, 2011
an attribute or some other setting. I am exporting the contents of a gridview to an excel spreadsheet. And for the most part it works great, with one minor annoyance, the export duplicates the entire gridview. In other words this is what I get:
Col1 | Col2 | Col3 | Etc | Col1 | Col2 | Col3 | Etc |
Code:
The GridView ASPX
<asp:GridView ID="GridViewList" runat="server"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="Solid"
BorderWidth="1px" CellPadding="3" Width="100%" Font-Size="8pt"
[code]....
View 2 Replies
Jun 14, 2010
I have a crystal report and everytime i export it to excel, all the columns and values are messed up. Is there a way that the same report that the users see in the crystal report viewer be formatted differently and more organized when exported to excel?
View 8 Replies
Jun 9, 2010
I have a simple export to excel functionality in my application. Code is :
[Code]....
View 2 Replies
Dec 21, 2010
I have an small ASP.NET application that reads data from a table and sends it out as an excel attachment in an email message. The data is simply HTML table tr td tagged data. The way I am sending the message is by the following code:
byte[] data = GetData(excelData);
MemoryStream memoryStream = new MemoryStream(data);
mm.Attachments.Add(new Attachment(memoryStream, "info.xls", "text/plain"));
This has been working fine in Excel 2003 but for some reason Excel 2007 keeps trying to convert the whole thing to a formula and I get a "Cell Data too Long" error. I've tried searching but couldn't really find anything specific about why this might be happening in 07 or a simple way to fix it. I know 07 probably handles data a little bit different than 03 but I don't have a lot of time to dedicate to reworking this app if possible.
View 2 Replies
Nov 25, 2013
My data of gridview is exporting to excel sheet but it is exporting extra buttons in that page also and also exporting the navigation links that i have used in the master page, Below is my code:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<cc2:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" > </cc2:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="padding-left:20px;line-height:1.5em;";>
<div style="width:100%";>
<div style="float:left";>
[code].....
View 1 Replies
Feb 11, 2014
I am looking at the following article [URL] .... its converting a gridview to excel. On my gridview I have a running total on the footer, and i do know to to change the code or add code to add this to my excel document...
View 1 Replies
Nov 2, 2013
How can I change the width of the exported gridview to pdf document
I followed your method, my gridview has 9 columns the width of the document is not expanded.
View 1 Replies
May 29, 2012
I am using report viewer to export a order form in PDF.
There is always additional one page is exported.
View 1 Replies
May 7, 2015
I have an issue in report viewer export Receipt into pdf. I am using your code and at time export the file name comes based on pagename. Like Receipt.pdf
If i want send receipt to my customer, i need to include the receipt number like TE724785872/201503-2. user always do wrong enter the receipt number to store in the folder to send the customer later.
It is also very diffcult find receipt on time of sending to customer. We have to open one by one and check and attached in email.
Is there any possible reportveiwer add receipt number automatically on time of export into PDF
(like TE72478/201308-2.pdf)
View 1 Replies
Nov 19, 2010
I am in the process of building a calorie calculator. I have a calculation ready to test but I am having trouble getting it to print as onto a blank label. Here is what I have so far. I just need to figure out how to print "maintainanswer" back to the user.
View 1 Replies
Jul 28, 2013
In my asp.net+vb web there is a code as under
If dt1.Tables("PresentTotal").Rows(0).Item("C") Is System.DBNull.Value <> True Then
ctxt.Text = dt1.Tables("PresentTotal").Rows(0).Item("C")
Else
ctxt.Text = ""
End If
The script works fine for those peoples number is in that table but when the number of that person is not there in tahat table then it gives error...
View 1 Replies
Sep 21, 2012
I need to do calculation of different no as shown in fig..right now i am doing addition in the normal way...adding all the values of the textboxes and thenn showig the result in the last textbox..what i want is whenever i change any value in the any textboxes it should automatically reflect the changes in the final calculation(final textbox) without using calculate button.
Below is my .aspx code
<asp:Panel ID="Panel2" runat="server" Height="387px" Width="83%">
<table style="width:108%; height: 390px;">
<tr>
<td>
<asp:Panel ID="Panel1" runat="server" Width="718px">
<table style="width:100%;">
[Code] .....
View 1 Replies
May 11, 2010
In a formview I need to present a new value calucalted by dividing one field value by another. I need to present the result to one decimal place. The code I am using is the following, however it presents the resulting value rounded up or down to the nearest whole value:
<asp:label id=lblTotal text='<%# Convert.ToInt32(Eval("Value1")) / Convert.ToInt32(Eval("value2")) %>' runat="server"></asp:label>
I did try and insert refernces to {0:N1} but this just threw asp.net errors. Any advise on how I can guarantee that the value calculated is presented to one decimal place?
View 4 Replies
Dec 1, 2010
I'm not sure how to do this, but I did read a lot of post and searched for it.
Protected Function GetTotal(ByVal DonTotalQty As Decimal, ByVal DonValue As Decimal)
View 5 Replies
Jan 16, 2010
I have two coloumns in a table to store Registered and Closed dates.
I want to calculate the period and to show in labels templated in detailsView.
Period should be like this:
72 Hrs and 58 minutes
View 9 Replies
Oct 10, 2010
Why am I getting this error? I'm trying to do a calculation on my GridView2 and I'm using clientside javascript. I need to add the onkeyup attribute. How do I do this?
Code Behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CType(GridView2.FindControl("TextBox13"), TextBox).Attributes.Add("onkeyup", "calculateSubTotal")
End Sub
View 5 Replies
Mar 4, 2010
How to make exported .XLS file Editable Thid code makes .XLS File Read Only
:(
using System;
using System.Data;
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class GridViewExportUtil
{
/// <param name="fileName"></param>
/// <param name="gv"></param>
public static void Export(string fileName, GridView gv)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format("content-disposition", "attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Charset = System.Text.Encoding.Unicode.EncodingName;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode;
HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
// Create a form to contain the grid
Table table = new Table();
// add the header row to the table
if (gv.HeaderRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
table.Rows.Add(gv.HeaderRow);
}
// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
GridViewExportUtil.PrepareControlForExport(row);
table.Rows.Add(row);
}
// add the footer row to the table
if (gv.FooterRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
table.Rows.Add(gv.FooterRow);
}
// render the table into the htmlwriter
table.RenderControl(htw);
// render the htmlwriter into the response
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
}
}
}
/// <summary>
/// Replace any of the contained controls with literals
/// </summary>
/// <param name="control"></param>
private static void PrepareControlForExport(Control control)
{
for (int i = 0; i < control.Controls.Count; i++)
{
Control current = control.Controls[i];
if (current is LinkButton)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as LinkButton).Text));
}
else if (current is ImageButton)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as ImageButton).AlternateText));
}
else if (current is HyperLink)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as HyperLink).Text));
}
else if (current is DropDownList)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as DropDownList).SelectedItem.Text));
}
else if (current is CheckBox)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? "True" : "False"));
}
if (current.HasControls())
{
GridViewExportUtil.PrepareControlForExport(current);
}
}
}
}
View 1 Replies
Mar 5, 2011
I've taken over the development of a website for a friend of mine. The original site manager used SiteFinity CMS, and hosted at winhost.com. I'm not changing this, but I wanted to create a local VS2010 project of the site that currently is hosted at winhost.com. How do I go about this? I have exported the site to a ZIP file through the IIS manager, but now my problem is getting that site into VS2010 blank C# Web project successfully. I've primarily worked with Dreamweaver to do site management before this is my first VS2010 site.
View 1 Replies
Mar 11, 2010
I am using a grid form to diplay data... the insert form is completely a separate form. In the insert form a text box called "FormPercentageTextBox" is getting a calculated result using javavascript based on some field ( field1,field2) values (val1, val2).
the problem i have is: when i edit the form and i want to update any value..i want the new calculation result showing on the edited "FormPercentageTextBox" field. I need to have this calculation reflected/
View 2 Replies
Dec 8, 2010
I have created RDLC Report in which there are some images. I have provided facility of export to pdf from RDLC.
Now the issue is that i want to disable copying images from exported pdf files.
disable copying images from exported pdf.
View 1 Replies
Jul 7, 2010
I have a report with some opening text, a table, and some closing text. The number of rows in the table can vary. When the report is exported to Excel or printed, the opening text is printed, then a pagebreak is inserted and the table starts on the second page. I want the everything to be continous with any pagebreaks occuring in the middle of the table.
I've tried modifying the body and page size. I've tried dragging the controls to the left and making them smaller. how to stop the unwanted pagebreaks from occuring?
View 4 Replies
Mar 16, 2010
I need to delete exported templates from VWD2008. I have deleted the actual files, but the templates still show up under my exported templates when you select add new item, anyone kow where these are stored?
View 2 Replies