<%@ Page Language="VB" EnableViewState="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>3D Cylinder Chart with ASP.NET and VB.NET Returns Open XML (XLSX) Workbook Using SpreadsheetGear 2010</title>
<meta content="3D Cylinder Chart with ASP.NET, Visual Basic .NET and SpreadsheetGear 2010, a royalty free Microsoft Excel compatible spreadsheet component for the Microsoft .NET Framework featuring the fastest and most complete calculation engine available. Create, read, modify, calculate and write Microsoft Excel workbooks from your Microsoft .NET, ASP.NET, C#, VB.NET and Microsoft Office solutions. Integrates with Microsoft Visual Studio .NET, including IntelliSense and Dynamic Help." name="description" />
<script language="VB" runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create a new workbook.
Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.GetWorkbook()
Dim worksheet As SpreadsheetGear.IWorksheet = workbook.Worksheets("Sheet1")
Dim windowInfo As SpreadsheetGear.IWorksheetWindowInfo = worksheet.WindowInfo
' Load some sample data.
Dim dataRange As SpreadsheetGear.IRange = worksheet.Cells("A2:D5")
dataRange.Formula = "=INT(RAND() * 10 + 5)"
' Add a chart to the worksheet's shape collection.
' NOTE: Calculate the coordinates of the chart by converting row
' and column coordinates to points. Use fractional row
' and colum values to get coordinates anywhere in between
' row and column boundaries.
Dim left As Double = windowInfo.ColumnToPoints(4.0)
Dim top As Double = windowInfo.RowToPoints(1.0)
Dim right As Double = windowInfo.ColumnToPoints(11.0)
Dim bottom As Double = windowInfo.RowToPoints(16.0)
Dim chart As SpreadsheetGear.Charts.IChart = _
worksheet.Shapes.AddChart(left, top, right - left, bottom - top).Chart
' Set the chart's source data range, plotting series in columns.
chart.SetSourceData(dataRange, SpreadsheetGear.Charts.RowCol.Columns)
' Set the chart type.
chart.ChartType = SpreadsheetGear.Charts.ChartType.CylinderColStacked
' Change 3D view properties.
chart.DepthPercent = 200
chart.Elevation = 0
chart.Rotation = 30
chart.Perspective = 120
' Stream the Excel spreadsheet to the client in Excel 2007-2010 Open XML format.
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("Content-Disposition", "attachment; filename=report.xlsx")
workbook.SaveToStream(Response.OutputStream, SpreadsheetGear.FileFormat.OpenXMLWorkbook)
Response.End()
End Sub 'Page_Load
</script>
</head>
<body>
</body>
</html>