UltraChart导出到Excel

  1. Here is a simple example of exporting the UltraChart to an Excel spreadsheet.  It uses Office Interop so you need to include a reference to the Microsoft Office 11 Object Library in your project.
  2.    1:  Public Class Export
  3.    2:  
  4.    3:      Private Sub ChartToExcel(ByVal chart As Infragistics.Win.UltraWinChart.UltraChart)
  5.    4:          Try
  6.    5:   
  7.    6:              Dim xl As New Excel.Application
  8.    7:              Dim wb As Excel.Workbook = xl.Workbooks.Add
  9.    8:              Dim sheet As Excel.Worksheet = wb.Worksheets(1)
  10.    9:              sheet.Visible = Excel.XlSheetVisibility.xlSheetVisible
  11.   10:   
  12.   11:              'add the top title to the sheet as the header
  13.   12:              sheet.Range("A1").Value = chart.TitleTop.Text
  14.   13:              sheet.Range("A1").Font.Bold = True
  15.   14:              sheet.Range("A1").Font.Size = 14
  16.   15:   
  17.   16:              Dim dt As DataTable = CType(chart.DataSource, DataSet).Tables("Data")
  18.   17:   
  19.   18:              'output the headers.
  20.   19:              Dim intCol As Integer = 1
  21.   20:              For Each col As DataColumn In dt.Columns
  22.   21:                  sheet.Cells(2, intCol) = col.ColumnName
  23.   22:                  intCol += 1
  24.   23:              Next
  25.   24:   
  26.   25:              'Bold the headers.
  27.   26:              sheet.Range("A2:" & Chr(64 + intCol) & "2").Font.Bold = True
  28.   27:              sheet.Range("A2:" & Chr(64 + intCol) & "2").Font.Size = 12
  29.   28:   
  30.   29:              'start our data on row 3 of the worksheet.
  31.   30:              Dim intRow As Integer = 3
  32.   31:              For Each row As DataRow In dt.Rows
  33.   32:                  intCol = 1
  34.   33:                  For Each col As DataColumn In dt.Columns
  35.   34:                      sheet.Cells(intRow, intCol) = row.Item(col.ColumnName)
  36.   35:                      intCol += 1
  37.   36:                  Next
  38.   37:                  intRow += 1
  39.   38:              Next
  40.   39:   
  41.   40:              wb.Application.Visible = True
  42.   41:   
  43.   42:              Dim oChart As Excel.Chart
  44.   43:              Dim xlsAxisCategory, xlsAxisValue As Excel.Axes
  45.   44:              Dim charts As Excel.ChartObjects = sheet.ChartObjects(Type.Missing)
  46.   45:   
  47.   46:              ' Adds a chart at x = 0, y = 0, 500 points wide and 300 tall.
  48.   47:              Dim chartObj As Excel.ChartObject = charts.Add(0, 0, 400, 300)
  49.   48:              oChart = chartObj.Chart
  50.   49:   
  51.   50:              Dim xlsSerie As Excel.SeriesCollection = oChart.SeriesCollection
  52.   51:              oChart.ChartType = Excel.XlChartType.xlLine
  53.   52:   
  54.   53:              'add 64 to intCol since ASCII A is 65 and then take the Chr() of it.BR>
  55.   54:              Dim chartRange As Excel.Range = sheet.Range("A1", Chr((intCol - 1) + 64) & intRow)
  56.   55:              oChart.SetSourceData(chartRange, Type.Missing)
  57.   56:   
  58.   57:              wb.Application.Visible = True
  59.   58:   
  60.   59:          Catch ex As Exception
  61.   60:              Console.WriteLine("Doh!")
  62.   61:          End Try
  63.   62:   
  64.   63:      End Sub
  65.   64:  End Class
摘要 UltraWinChart与ASP.NET 中UltraWebChart 一样,提供了丰富的对象模块,可视化的显示大量以及各种分类信息,为Windows Forms应用程序带来前所未有的方便。UltraWinChart内置了大量的图形备选项,包含了设计时各种选项,以及内置的美学增强功能。使得图表数据具有前所未有的心动、精美和专业。 组件列表 技术特性 应用场景 适用于.NET环境下图表显示应用程序 运用优势 2D/3D图表类型 — ;;; ;;; ;;; ;;; 包含了所有主要的图表类型:Bar, Column, Line, Area, Pie, Scatter, Bubble, HeatMap, Candle, HiLow, and OpenClose Financial等等。 智能化显示功能 — ;;; ;;; ;;; ;;; UltraWinChart独有的IntelliRend™;;;技术,大大提高了使用效率和可用性。我们将每一种便利,直观的设计理念,高级开发人员控件都融入于UltraWinChart之中。 数据绑定和非绑定模式 — ;;; ;;; ;;; ;;; 使用DataSource属性,可从数据库或数组中读取图表。内部的过滤让可提供的数据模式于所需绘制的图表选择类型相匹配。更可让开发者在图表绘制中调整行和列的包含/非包含的情况。 强大的美学增强— 图表不仅仅采用点阵表示,最重要的是数据的外观显示。为了轻松的显示您的图表,UltraWinChart提供了内置的增强功能: 1) 边缘圆滑过渡-边缘圆滑过渡的显示图表图像,生成高级数据显示,并自动圆滑边缘和颜色转换。 2)alpha混合和透明 — UltraWinChart提供了完整的alpha混合和透明控件,而且可以全球设置。 3)背景图象 —可以在图表的背景中显示一些公司的数据信息,例如公司的logo标志和“机密”的水印记号。 4)增强的颜色模式 —可避免显示多余的点或杂乱的图表项。 5)创新的分层设计 — UltraWinChart提供了分层设计,并可自动混合这些分层,以达到最佳的视觉效果。 6)图标符号 —UltraWinChart可生成大量的图标集,完全控制图标的外观。 标签 - 高级工具使用提示帮助—可完全定制工具提示,提供了优雅的停靠并显示了对细节的注重。 设计时超级方便 —能够真正帮助开发者实现RAD(实时应用程序开发)。UltraWinChart 提供了高级的用户界面属性编辑器,所见即所得的图表设置,加上与所选图表相关联的上下文属性以及设计时绑定到一个DataSet。 支持Windows事件 —提供了丰富的无缝集成的事件集,监测用户与图表数据的交互。 数据高亮显示—当鼠标移动,移上或点击时,图表项中的数据将会自动高亮显示,提供给应用程序的用户丰富强大的交互功能。 强调细节—UltraWinChart 加强了细节部分,其中包括RAD设计时配置、自动数据缩放和数据高亮显示、高级工具使用提示帮助、完全可自定义的图标符号、标签、打印等等。 开发环境 ";;;Microsoft Visual Studio .NET Microsoft Visual Basic .NET";;; ";;;Microsoft Visual C++ .NET Microsoft Visual C# .NET";;; .NET Common Language Runtime V1.0 支持平台 标准报价 5,450 元人民币 * 以上报价仅供参考,具体以厂商正式报价为准。 电话 021-58549800 Email: tools@sh.grapecity.com http://www.grapecity.com/china
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值