隨記 C#

Crystal Report ExportFormatType 型別

張貼者:2010/10/27 下午3:56Yichang Wu

http://msdn.microsoft.com/zh-tw/library/ms226443%28VS.80%29.aspx

CrystalReport            報表的匯出格式為 Crystal Report 檔案。
Excel                       報表的匯出格式為 Microsoft Excel 檔案。
ExcelRecord              報表的匯出格式為 Excel Record 檔案。
HTML32                    報表的匯出格式為 HTML 3.2 檔案。
HTML40                    報表的匯出格式為 HTML 4.0 檔案。
NoFormat                  未指定匯出格式。
PortableDocFormat     報表的匯出格式為 PDF 檔案。
RichText                  報表的匯出格式為 Rich Text 檔案。
WordForWindows       報表的匯出格式為 Microsoft Word 檔案。 (副檔 .doc word格式, 非 .docx ooxml)

在 CrystalReport 中 動態載入外部圖片

張貼者:2010/10/17 上午11:20Yichang Wu   [ 已更新 2010/10/17 上午11:26 ]


在 ASP.Net 的 CrystalReport 中 動態載入外部圖片

http://blog.blueshop.com.tw/timothychi/archive/2006/12/26/48912.aspx
在 ASP.Net 的 CrystalReport 中沒有 Graphic Location 所以要如何動態載入外部圖片呢?
我們可以使用 Push 的方式先把圖放在 DataSet 中在推到報表中

在報表中選用這一個 DataSet 並把圖片欄位拉至適當位置
在PageLoad 時指定報表資料來源即可

Bitmap objBitmap = GetYourBitMap();
DataTable MyDT = new ReportPictureDataSet.MyTableDataTable();

DataRow MyRow = MyDT.NewRow();

MemoryStream MyMS = new MemoryStream();

objBitmap.Save(MyMS, ImageFormat.Png); //把圖片塞到DataSet

MyRow["Picture"] = MyMS.ToArray();

MyMS.Close();

MyMS.Dispose();

MyDT.Rows.Add(MyRow);

CrystalReportSource1.ReportDocument.SetDataSource(MyDT); //指定報表的資料來源


Image in Crystal Reports

http://www.codeproject.com/KB/vb/Image_in_Crystal_Reports.aspx

imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length))); drow(0) = imgbyte; // add the image in bytearray dt.Rows.Add(drow); // add row into the datatable


C#存取XML

張貼者:2010/6/10 下午2:39吳小昌   [ Yichang Wu 已於 2010/6/10 下午4:14 更新 ]

http://studio.zeuik.com/wordpress/?p=76
http://studio.zeuik.com/?p=76

   1. using System.Xml;
   2.  
   3. XmlDocument xmlDoc = new XmlDocument();
   4. xmlDoc.Load("listServer.xml");
   5.  
   6. XmlNodeList myNodeList = xmlDoc.SelectNodes("/listServer/info");
   7. int totalServer = myNodeList.Count;
   8.  
   9. // 方法 1:
  10. for (int i = 0; i < totalServer; i++) {
  11.     MessageBox.Show("[1]"+myNodeList.Attributes[0].InnerText);
  12. }
  13.  
  14. // 方法 2:
  15. foreach (XmlNode xn in myNodeList) {
  16.     XmlElement xe = (XmlElement)xn;
  17.     MessageBox.Show("[2]"+xe.GetAttribute("name"));
  18. }

   1. <?xml version="1.0" encoding="utf-8" ?>
   2. <listServer>
   3.     <info name="香港伺服器" url="http://studio.zeuik.com/downloadList.xml" />
   4.     <info name="台灣伺服器" url="http://asp.zeuik.com/downloadList.xml" />
   5. </listServer>

DataAdapter.Update(Table) 需建立 CommandBuilder

張貼者:2009/6/3 下午9:02Yichang Wu

資料來源:Dr. TKLi

SqlCommandBuilder dbb = new SqlCommandBuilder( SqlDataAdapter );
SqlDataAdapter.Update(DT_1);

C# 字串左右補位

張貼者:2009/3/9 上午8:12Yichang Wu   [ 已更新 2009/3/9 上午8:28 ]

左側補 0 至 10 位
    string.PadLeft( 10, '0' );
右側補 0 至 10 位
    string.PadRight( 10, '0' );

C# 取得 exe 所在實體路徑

張貼者:2009/3/9 上午7:45Yichang Wu   [ 已更新 2009/3/9 上午8:28 ]

System.AppDomain.CurrentDomain.BaseDirectory
        ex 取得 c:\project\main\
System.Windows.Forms.Application.StartupPath
        ex 取得 c:\project\main

差最後一個 \

參考: http://www.blueshop.com.tw/board/show.asp?subcde=BRD20070702120225TXD&fumcde=FUM20050124192253INM&rplcnt=7

1-6 of 6