ได้บ้านใหม่แล้วครับ ดูแล้วใช้งานง่ายกว่าบ้านเดิม http://usedotnet.blogspot.com บ้านนี้ก็เหมือนกับบ้านเดิมนั่นแหล่ะครับ พบอะไรเจออะไรที่น่าสนใจที่เป็นความรู้จะเอามาลงเก็บไว้ก่อน ไว้เป็น Reference ไว้ดูไว้ภายหลังได้ ขอบคุณครับสำหรับการเยี่ยมชม ^^

http://shaikhsohail.wordpress.com/2008/09/27/how-to-crack-unprotect-or-remove-document-protection-in-word/

Ever run into situation where someone sends you a read-only password protected Word document, but wants you to make changes?
Here’s how to crack it if you are using the newer versions of Word:

If you are using office XP or 2003, you can change the view to HTML-Code using Microsoft Script-Editor by pressing the [Alt]+[Shift]+[F11] key combination.

Search for “Password” and you will find somethimg like this:
<w:DocumentProtection>ReadOnly</w:DocumentProtection>
<w:UnprotectPassword>19E8E61E</w:UnprotectPassword>

To remove the protection:
-Just remowe those two lines, and after saving the document , the protection is gone.

To remove the password:
-replace the Password, here “19E8E61E”, with “00000000″, save the Document and close “Script-Editor”.

Alternative you can save your document as .html and use a html-Editor

ตัวอย่าง

http://www.aurora.co.th/page_a.php?cid=35

http://wikimapia.org/#lat=14.0040744&lon=100.5626249&z=16&l=0&m=b

มาทำปุ่มปิดหน้าต่างทั้งหมดโดยการกดครั้งเดียวกันเถอะ

http://www.ntwind.com/software/utilities/close-all.html

1. GridView to Excel

ตัวอย่างนี้จะได้ Format ของ GridView มาด้วย ถ้ามีรูปอยู่ใน GridView ต้องเป็น Full URL Path ถึงจะ Export รูปออกมาได้ เช่น http://xxx.com/test/pic.png ถ้าเป็น /test/pic.png แบบนี้รูปจะไม่มาด้วย

    protected void btnExport_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.xls");
        Response.ContentType = "application/vnd.ms-excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        GridView1.RenderControl(hw);
        Response.Output.Write(sw.ToString());
        Response.Flush();
        Response.End();
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
        /* Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. */
    }

แบบนี้ format ทีเป็น style จะไม่มาด้วย

    protected void btnExport_Click(object sender, EventArgs e)
    {
        Response.ClearContent();
        Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = _contentType;
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        System.Web.UI.HtmlControls.HtmlForm frm = new System.Web.UI.HtmlControls.HtmlForm();
        frm.Attributes["runat"] = "server";
        frm.Controls.Add(GridView1);
        GridView1.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }

2. Copy / Paste
วิธีนี้ใช้ได้โดยครอบส่วนที่ต้องการ Copy โดยใช้ Tag div แล้วให้ user กดที่ button Copy แล้วนำไป Paste ที่ Excel

<input type="button" value="Copy" onclick="window.clipboardData.setData('Text', document.all['MainDiv'].innerHTML)" />

3. Export to CSV
โดยดึงข้อมูลจาก DataTable

    protected void btnExport_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("th-TH");
        DataTable dt = Session["ActualReceive"] as DataTable;
        Response.ClearContent();
        Response.AddHeader("Content-Disposition", "attachment;filename=ActualReceiveReport.csv");
        Response.ContentType = "application/vnd.ms-excel";
        string tab = "";
        foreach (DataColumn dc in dt.Columns)
        {
            Response.Write(tab + "\"" + dc.ColumnName + "\"");
            tab = ",";
        }
        Response.Write("\r\n");

        foreach (DataRow dr in dt.Rows)
        {
            tab = "";
            int i;
            for (i = 0; i < dt.Columns.Count; i++)
            {
                Response.Write(tab + "\"" + dr[i].ToString().Replace("\"","\"\"") + "\"");
                tab = ",";
            }
            Response.Write("\r\n");
        }
        Response.End();
    }

http://aspalliance.com/
http://www.aspsnippets.com/ มี export -> word, pdf ด้วย
http://mattberseth.com/
http://forums.asp.net/

เจอปัญหาการแปลง datatype จาก float ไปเป็น varchar ข้อมูลจะอยู่ในรูป 1.29913e+006

วิธีแก้

Wrap your float within the str() function which, when given only one parameter, does have the side effect of dropping off everything to the right of the decimal point.

Problem:

select cast(cast(1234567890.01 as float) as varchar)

1.23457e+009

Answer without decimal:

select str(cast(1234567890.01 as float))

1234567890 

Answer with decimal:

select str(cast(1234567890.01 as float),13,2)
 
1234567890.01

ที่มา http://stackoverflow.com/

Next Page »

Follow

Get every new post delivered to your Inbox.