如何将Html转换为CSV文件 [英] How to Convert Html To CSV file

查看:96
本文介绍了如何将Html转换为CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是ConvetPDF Class



使用System;

使用System.Collections.Generic;

使用System.Linq;

使用System.Web;

使用iTextSharp.text;

使用iTextSharp.text.pdf;

使用System.IO;

///< summary>

/// clsPdfConversion的摘要说明

///

公共类clsPdfConversion

{

public clsPdfConversion()

{

//

// TODO:在这里添加构造函数逻辑

//

}



public static string strPdfContent = string.Empty;



public static string HTMLToPdf(string HTML,string fileName)

{

文档document = new Document();

string appRootDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

PdfWriter.GetInstance(document,new FileS tream(appRootDir +\\+ fileName +。pdf,FileMode.Create));

document.Open();

//图片pdfImage = Image.GetInstance(Server.MapPath('logo.png'));



//pdfImage.ScaleToFit(100,50);



//pdfImage.Alignment = iTextSharp.text.Image.UNDERLYING; pdfImage.SetAbsolutePosition(180,760);



//document.Add(pdfImage);

iTextSharp.text.html.simpleparser。 StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet();

iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);

hw.Parse(new StringReader(HTML));

document.Close();

return(appRootDir +\\ + fileName +。pdf);

}





}







javaScript代码





this is ConvetPDF Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
/// <summary>
/// Summary description for clsPdfConversion
///
public class clsPdfConversion
{
public clsPdfConversion()
{
//
// TODO: Add constructor logic here
//
}

public static string strPdfContent = string.Empty;

public static string HTMLToPdf(string HTML, string fileName)
{
Document document = new Document();
string appRootDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
PdfWriter.GetInstance(document, new FileStream(appRootDir + "\\" + fileName + ".pdf", FileMode.Create));
document.Open();
//Image pdfImage = Image.GetInstance(Server.MapPath('logo.png'));

//pdfImage.ScaleToFit(100, 50);

//pdfImage.Alignment = iTextSharp.text.Image.UNDERLYING; pdfImage.SetAbsolutePosition(180, 760);

//document.Add(pdfImage);
iTextSharp.text.html.simpleparser.StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet();
iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
hw.Parse(new StringReader(HTML));
document.Close();
return (appRootDir + "\\" + fileName + ".pdf");
}


}



javaScript Code


function exportSalesToPdf(sellingId) {

           // jQuery("#LoadingImageExportToPdf").show();

            PageMethods.exportSalesToPdf_wm(sellingId, function () {

                window.open("Export.aspx", "mYwindow");

            });
        }











这是我的webmethod


















this is my webmethod






[WebMethod]
    public static void exportSalesToPdf_wm(int iSellingId)
    {
        BAL.clsSellingAnalytics objSellingAnalytics = new BAL.clsSellingAnalytics();
        DataTable success_user_dt = new DataTable();
        DataTable sale_dt = new DataTable();
        StringBuilder HTML = new StringBuilder();

        string msg = string.Empty;
        string strProfit = string.Empty;


            objSellingAnalytics.GetSellingIdOfUser = iSellingId;
            DataSet ds = objSellingAnalytics.SelectSuccessfulSalesOfUser_AllRecords();
            sale_dt = ds.Tables[0];
            success_user_dt = ds.Tables[1];

            string strCurrencySymbol = "$";

            if (Convert.ToString(sale_dt.Rows[0]["temp_currency_symbol"]) == "Rs.")
            {
                strCurrencySymbol = "Rs.";
            }

            if (strCurrencySymbol == "$")
            {
                strProfit = objSellingAnalytics.calculateProfit("NON-INR");
            }
            else if (strCurrencySymbol == "Rs.")
            {
                strProfit = objSellingAnalytics.calculateProfit("INR");
            }



            if (sale_dt.Rows.Count > 0)
            {
                string view_and_sell_count = objSellingAnalytics.Count_views(ref msg);
                HTML.Append("<div style='font-family:&#39;Helvetica Neue&#39;, Arial;background: #fafafa; padding: 10px; margin-top: 2px'>" +
                   "<h3 style='text-align: center; background: #7be4a9; padding: 6px; color: #fff; font-size: 22px'>" + sale_dt.Rows[0]["temp_creation_title"] + "</h3>" +
                   "<div style='text-align: center'>" +
                   " <span style='font-size: 28px; color: #999; font-weight: 700'>" + view_and_sell_count.Split('/').First() + " views</span>" +
                   " <span style='font-size: 28px; margin-left: 20px; color: #97dda8; font-weight: 700'>" + view_and_sell_count.Split('/').Last() + " sales</span>" +
                   " <span style='font-size: 28px; margin-left: 20px; color: #ff9f81; font-weight: 700'>" + strCurrencySymbol + strProfit + " profit</span>" +
                   "</div>");


                HTML.Append("<div style='margin-top: 20px'>" +
                    " <h4 style='color: #999; font-size: 22px; margin-top: 10px; text-align: center'>" +
                    " Successful sales</h4>");

                foreach (DataRow dr in sale_dt.Rows)
                {

                    string strImageLink = string.Empty;
                    string strFullName = string.Empty;
                    double fsingleTicketPrice = 0.0;
                    int iTicketQuantity = 0;
                    if (dr["buyr_id"].ToString() != "0")
                    {
                        DataRow[] row_from = success_user_dt.Select("user_id ='" + dr["buyr_id"].ToString() + "'");
                        strImageLink = Convert.ToString(row_from[0]["image_link"]);
                        strFullName = Convert.ToString(row_from[0]["full_name"]);
                    }
                    else
                    {

                        strImageLink = "https://d297tiqatb0yra.cloudfront.net/images/solos/default_image_male.jpg";
                        strFullName = Microsoft.Security.Application.Encoder.HtmlEncode(Convert.ToString(dr["mail"]));
                    }

                    HTML.Append(
                    "<div  style='padding: 10px; background: #fff'>" +
                    "<img style='width: 32px;height: 32px;border-radius: 100px;' src='" + strImageLink + "' >" +
                    " <span style='color: #ffa775'>" + strFullName + "</span>");


                    if (Convert.ToInt32(dr["temp_shipping_status"]) == 1)
                    {
                        HTML.Append("<span style='color: #bdbdbd;margin-left: 20px; '>");

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_street_address"])))
                        {
                            HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(Convert.ToString(dr["temp_street_address"])));
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_city"])))
                        {
                            HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(", " + dr["temp_city"]));
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_state"])))
                        {
                            HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(", " + dr["temp_state"]));
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_country_name"])))
                        {
                            HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(", " + dr["temp_country_name"]));
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_pin_code"])))
                        {
                            HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(" - " + dr["temp_pin_code"]));
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_phone_no"])))
                        {
                            HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(". Ph: " + dr["temp_phone_no"]));
                        }

                        HTML.Append("</span>");

                    }

                    HTML.Append("<div style='float: right'>" );

                    string amount = Convert.ToString(dr["amount"]);
                    double multipliedAmount = 0.0;

                    string[] amouns = amount.Split('.');

                    double dAmount = Convert.ToDouble(amount);
                    double dQuantity = Convert.ToDouble(dr["temp_quantity"]);



                    if (amouns[1] == "00")
                    {
                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_quantity"])))
                        {

                            if (dQuantity > 1.0)
                            {
                                iTicketQuantity = Convert.ToInt32(dr["temp_quantity"]);
                                fsingleTicketPrice = Math.Round(Convert.ToDouble(amouns[0]) / Convert.ToDouble(dr["temp_quantity"]), 2);
                                HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + fsingleTicketPrice + " x " + dr["temp_quantity"] + "</span>");
                                multipliedAmount = fsingleTicketPrice * dQuantity;
                            }
                            else
                            {
                                HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + amouns[0] + "</span>");
                                multipliedAmount = dAmount;
                            }
                        }
                        else
                        {
                            HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + amouns[0] + "</span>");
                            multipliedAmount = dAmount;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_quantity"])))
                        {

                            if (dQuantity > 1.0)
                            {
                                iTicketQuantity = Convert.ToInt32(dr["temp_quantity"]);
                                fsingleTicketPrice = Math.Round(Convert.ToDouble(dr["amount"]) / Convert.ToDouble(dr["temp_quantity"]), 2);
                                HTML.Append("<span style='color: #bdbdbd;'>" + strCurrencySymbol + fsingleTicketPrice + " x " + dr["temp_quantity"] + "</span>");
                                multipliedAmount = fsingleTicketPrice * dQuantity;
                            }
                            else
                            {
                                HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + dr["amount"] + "</span>");
                                multipliedAmount = dAmount;
                            }
                        }
                        else
                        {
                            HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + Convert.ToString(dr["amount"]) + "</span>");
                            multipliedAmount = dAmount;
                        }
                    }


                    if (Convert.ToInt32(dr["temp_refund_status"]) == 1)
                    {
                        HTML.Append("<span style='color: #bdbdbd; '> (Refunded " + strCurrencySymbol + dr["temp_refund_amount"] + ")</span>");
                    }
                    else if (Convert.ToInt32(dr["temp_refund_status"]) == 2)
                    {
                        HTML.Append("<span style='color: #bdbdbd; '>(Charged back)</span>");
                    }

                    //if (Convert.ToInt32(dr["temp_failed_status"]) == 1)
                    //{
                    //    HTML.Append("<span style='color: #bdbdbd; '>Failed</span>");
                    //}



                    HTML.Append("</div>" +
                       " </div>");

                }

                HTML.Append(" </div>" +
                    " </div>");
            }


            clsPdfConversion.strPdfContent = Convert.ToString(HTML);
            ClsCSVConversion.strCsvContent = Convert.ToString(HTML);

    }

推荐答案

;

if(Convert.ToString(sale_dt) .Rows [0] [temp_currency_symbol])==Rs。)
{
strCurrencySymbol =Rs。;
}

if(strCurrencySymbol ==
"; if (Convert.ToString(sale_dt.Rows[0]["temp_currency_symbol"]) == "Rs.") { strCurrencySymbol = "Rs."; } if (strCurrencySymbol == "



{
strProfit = objSellingAnalytics.calculateProfit(NON-INR);
}
else if( strCurrencySymbol ==Rs。)
{
strProfit = objSellingAnalytics.calculateProfit(INR);
}



if (sale_dt.Rows.Count> 0)
{
string view_and_sell_count = objSellingAnalytics.Count_views(ref msg);
HTML.Append(< ; div style < span class =code-keyword> =' font-family:&#39; Helvetica Neue&#39;,Arial; background:#fafafa;填充:10px; margin-top:2px' > +
< < span class =code-leadattribute> h3 style =' text-align:center;背景:#7be4a9;填充:6px;颜色:#fff; font-size:22px' > + sale_dt.Rows [0] [temp_creation_title] +< / h3 > +
< div style =' text-align:center' > +
< span 样式 =' font-size:28px;颜色:#999; font-weight:700' > + view_and_sell_count.Split('/')。First()+views < / span > +
< span 样式 =' font-size:28px; margin-left:20px;颜色:#97dda8; font-weight:700' > + view_and_sell_count.Split('/')。Last()+sales < / span > +
< span 样式 =' font-size:28px; margin-left:20px;颜色:#ff9f81; font-weight:700' > + strCurrencySymbol + strProfit +profit < / span > +
< ; / div > );


HTML.Append(< div 样式 =' margin-top:20px' > +
< h4 style =' 颜色:#999; font-size:22px; margin-t op:10px; text-align:center' > +
成功销售< / h4 > );

foreach(SaleRt中的DataRow博士) .Rows)
{

string strImageLink = string.Empty;
string strFullName = string.Empty;
double fsingleTicketPrice = 0.0;
int iTicketQuantity = 0;
if(dr [buyr_id]。ToString()!=0)
{
DataRow [] row_from = success_user_dt.Select(user_id ='+ dr [ buyr_id]。ToString()+');
strImageLink = Convert.ToString(row_from [0] [image_link]);
strFullName = Convert.ToString(row_from [0] [ full_name]);
}
else
{

strImageLink =https://d297tiqatb0yra.cloudfront.net/images/solos/default_image_male.jpg;
strFullName = Microsoft.Security.Application.Encoder.HtmlEncode(Convert.ToString(dr [mail]));
}

HTML.Append(
< div style =' padding:10px; background:#fff' > +
< img 样式 =' width:32px; height: 32px; border-radius:100px;' src =' + strImageLink +' > +
< span 样式 =' 颜色:#ffa775' > + strFullName +< / span < span class =code-keyword>> );


if(Convert.ToInt32(dr [temp_shipping_status])== 1)
{
HTML.Append(< span style =' 颜色:#bdbdbd; margin-left:20px;' > );

if(!string.IsNullOrEmpty(Convert.ToString(dr [temp_street_address])))
{
HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode (Convert.ToString(DR [ temp_street_address])));
}

if(!string.IsNullOrEmpty(Convert.ToString(dr [temp_city])))
{
HTML.Append(Microsoft.Security。 Application.Encoder.HtmlEncode(,+ dr [temp_city]));
}

if(!string.IsNullOrEmpty(Convert.ToString(dr [temp_state])))
{
HTML.Append(Microsoft.Security。 Application.Encoder.HtmlEncode(,+ dr [temp_state]));
}

if(!string.IsNullOrEmpty(Convert.ToString(dr [temp_country_name])))
{
HTML.Append(Microsoft.Security。 Application.Encoder.HtmlEncode(,+ dr [temp_country_name]));
}

if(!string.IsNullOrEmpty(Convert.ToString(dr [temp_pin_code])))
{
HTML.Append(Microsoft.Security。 Application.Encoder.HtmlEncode( - + dr [temp_pin_code]));
}

if(!string.IsNullOrEmpty(Convert.ToString(dr [temp_phone_no])))
{
HTML.Append(Microsoft.Security。 Application.Encoder.HtmlEncode(。Ph:+ dr [temp_phone_no]));
}

HTML.Append(\"</span>\");

}

HTML.Append(\"<div style='float: right'>\" );

string amount = Convert.ToString(dr[\"amount\"]);
double multipliedAmount = 0.0;

string[] amouns = amount.Split('.');

double dAmount = Convert.ToDouble(amount);
double dQuantity = Convert.ToDouble(dr[\"temp_quantity\"]);



if (amouns[1] == \"00\")
{
if (!string.IsNullOrEmpty(Convert.ToString(dr[\"temp_quantity\"])))
{

if (dQuantity > 1.0)
{
iTicketQuantity = Convert.ToInt32(dr[\"temp_quantity\"]);
fsingleTicketPrice = Math.Round(Convert.ToDouble(amouns[0]) / Convert.ToDouble(dr[\"temp_quantity\"]), 2);
HTML.Append(\"<span style='color: #bdbdbd; '>\" + strCurrencySymbol + fsingleTicketPrice + \" x \" + dr[\"temp_quantity\"] + \"</span>\");
multipliedAmount = fsingleTicketPrice * dQuantity;
}
else
{
HTML.Append(\"<span style='color: #bdbdbd; '>\" + strCurrencySymbol + amouns[0] + \"</span>\");
multipliedAmount = dAmount;
}
}
else
{
HTML.Append(\"<span style='color: #bdbdbd; '>\" + strCurrencySymbol + amouns[0] + \"</span>\");
multipliedAmount = dAmount;
}
}
else
{
if (!string.IsNullOrEmpty(Convert.ToString(dr[\"temp_quantity\"])))
{

if (dQuantity > 1.0)
{
iTicketQuantity = Convert.ToInt32(dr[\"temp_quantity\"]);
fsingleTicketPrice = Math.Round(Convert.ToDouble(dr[\"amount\"]) / Convert.ToDouble(dr[\"temp_quantity\"]), 2);
HTML.Append(\"<span style='color: #bdbdbd;'>\" + strCurrencySymbol + fsingleTicketPrice + \" x \" + dr[\"temp_quantity\"] + \"</span>\");
multipliedAmount = fsingleTicketPrice * dQuantity;
}
else
{
HTML.Append(\"<span style='color: #bdbdbd; '>\" + strCurrencySymbol + dr[\"amount\"] + \"</span>\");
multipliedAmount = dAmount;
}
}
else
{
HTML.Append(\"<span style='color: #bdbdbd; '>\" + strCurrencySymbol + Convert.ToString(dr[\"amount\"]) + \"</span>\");
multipliedAmount = dAmount;
}
}


if (Convert.ToInt32(dr[\"temp_refund_status\"]) == 1)
{
HTML.Append(\"<span style='color: #bdbdbd; '> (Refunded \" + strCurrencySymbol + dr[\"temp_refund_amount\"] + \")</span>\");
}
else if (Convert.ToInt32(dr[\"temp_refund_status\"]) == 2)
{
HTML.Append(\"<span style='color: #bdbdbd; '>(Charged back)</span>\");
}

//if (Convert.ToInt32(dr[\"temp_failed_status\"]) == 1)
//{
// HTML.Append(\"<span style='color: #bdbdbd; '>Failed</span>\");
//}



HTML.Append(\"</div>\" +
\" </div>\");

}

HTML.Append(\" </div>\" +
\" </div>\");
}


clsPdfConversion.strPdfContent = Convert.ToString(HTML);
ClsCSVConversion.strCsvContent = Convert.ToString(HTML);

}
") { strProfit = objSellingAnalytics.calculateProfit("NON-INR"); } else if (strCurrencySymbol == "Rs.") { strProfit = objSellingAnalytics.calculateProfit("INR"); } if (sale_dt.Rows.Count > 0) { string view_and_sell_count = objSellingAnalytics.Count_views(ref msg); HTML.Append("<div style='font-family:&#39;Helvetica Neue&#39;, Arial;background: #fafafa; padding: 10px; margin-top: 2px'>" + "<h3 style='text-align: center; background: #7be4a9; padding: 6px; color: #fff; font-size: 22px'>" + sale_dt.Rows[0]["temp_creation_title"] + "</h3>" + "<div style='text-align: center'>" + " <span style='font-size: 28px; color: #999; font-weight: 700'>" + view_and_sell_count.Split('/').First() + " views</span>" + " <span style='font-size: 28px; margin-left: 20px; color: #97dda8; font-weight: 700'>" + view_and_sell_count.Split('/').Last() + " sales</span>" + " <span style='font-size: 28px; margin-left: 20px; color: #ff9f81; font-weight: 700'>" + strCurrencySymbol + strProfit + " profit</span>" + "</div>"); HTML.Append("<div style='margin-top: 20px'>" + " <h4 style='color: #999; font-size: 22px; margin-top: 10px; text-align: center'>" + " Successful sales</h4>"); foreach (DataRow dr in sale_dt.Rows) { string strImageLink = string.Empty; string strFullName = string.Empty; double fsingleTicketPrice = 0.0; int iTicketQuantity = 0; if (dr["buyr_id"].ToString() != "0") { DataRow[] row_from = success_user_dt.Select("user_id ='" + dr["buyr_id"].ToString() + "'"); strImageLink = Convert.ToString(row_from[0]["image_link"]); strFullName = Convert.ToString(row_from[0]["full_name"]); } else { strImageLink = "https://d297tiqatb0yra.cloudfront.net/images/solos/default_image_male.jpg"; strFullName = Microsoft.Security.Application.Encoder.HtmlEncode(Convert.ToString(dr["mail"])); } HTML.Append( "<div style='padding: 10px; background: #fff'>" + "<img style='width: 32px;height: 32px;border-radius: 100px;' src='" + strImageLink + "' >" + " <span style='color: #ffa775'>" + strFullName + "</span>"); if (Convert.ToInt32(dr["temp_shipping_status"]) == 1) { HTML.Append("<span style='color: #bdbdbd;margin-left: 20px; '>"); if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_street_address"]))) { HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(Convert.ToString(dr["temp_street_address"]))); } if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_city"]))) { HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(", " + dr["temp_city"])); } if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_state"]))) { HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(", " + dr["temp_state"])); } if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_country_name"]))) { HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(", " + dr["temp_country_name"])); } if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_pin_code"]))) { HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(" - " + dr["temp_pin_code"])); } if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_phone_no"]))) { HTML.Append(Microsoft.Security.Application.Encoder.HtmlEncode(". Ph: " + dr["temp_phone_no"])); } HTML.Append("</span>"); } HTML.Append("<div style='float: right'>" ); string amount = Convert.ToString(dr["amount"]); double multipliedAmount = 0.0; string[] amouns = amount.Split('.'); double dAmount = Convert.ToDouble(amount); double dQuantity = Convert.ToDouble(dr["temp_quantity"]); if (amouns[1] == "00") { if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_quantity"]))) { if (dQuantity > 1.0) { iTicketQuantity = Convert.ToInt32(dr["temp_quantity"]); fsingleTicketPrice = Math.Round(Convert.ToDouble(amouns[0]) / Convert.ToDouble(dr["temp_quantity"]), 2); HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + fsingleTicketPrice + " x " + dr["temp_quantity"] + "</span>"); multipliedAmount = fsingleTicketPrice * dQuantity; } else { HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + amouns[0] + "</span>"); multipliedAmount = dAmount; } } else { HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + amouns[0] + "</span>"); multipliedAmount = dAmount; } } else { if (!string.IsNullOrEmpty(Convert.ToString(dr["temp_quantity"]))) { if (dQuantity > 1.0) { iTicketQuantity = Convert.ToInt32(dr["temp_quantity"]); fsingleTicketPrice = Math.Round(Convert.ToDouble(dr["amount"]) / Convert.ToDouble(dr["temp_quantity"]), 2); HTML.Append("<span style='color: #bdbdbd;'>" + strCurrencySymbol + fsingleTicketPrice + " x " + dr["temp_quantity"] + "</span>"); multipliedAmount = fsingleTicketPrice * dQuantity; } else { HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + dr["amount"] + "</span>"); multipliedAmount = dAmount; } } else { HTML.Append("<span style='color: #bdbdbd; '>" + strCurrencySymbol + Convert.ToString(dr["amount"]) + "</span>"); multipliedAmount = dAmount; } } if (Convert.ToInt32(dr["temp_refund_status"]) == 1) { HTML.Append("<span style='color: #bdbdbd; '> (Refunded " + strCurrencySymbol + dr["temp_refund_amount"] + ")</span>"); } else if (Convert.ToInt32(dr["temp_refund_status"]) == 2) { HTML.Append("<span style='color: #bdbdbd; '>(Charged back)</span>"); } //if (Convert.ToInt32(dr["temp_failed_status"]) == 1) //{ // HTML.Append("<span style='color: #bdbdbd; '>Failed</span>"); //} HTML.Append("</div>" + " </div>"); } HTML.Append(" </div>" + " </div>"); } clsPdfConversion.strPdfContent = Convert.ToString(HTML); ClsCSVConversion.strCsvContent = Convert.ToString(HTML); }


这篇关于如何将Html转换为CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆