Tab 1
此 Demo 展示如何使用 Marker Designer,基于模板导出 Excel。
Data
Name | Capital | Continent | Area | Population |
Argentina | Buenos Aires | South America | 2777815 | 32300003 |
Bolivia | La Paz | South America | 1098575 | 7300000 |
Brazil | Brasilia | South America | 8511196 | 150400000 |
Canada | Ottawa | North America | 9976147 | 26500000 |
Chile | Santiago | South America | 756943 | 13200000 |
Colombia | Bagota | South America | 1138907 | 33000000 |
Cuba | Havana | North America | 114524 | 10600000 |
Ecuador | Quito | South America | 455502 | 10600000 |
El Salvador | San Salvador | North America | 20865 | 5300000 |
Guyana | Georgetown | South America | 214969 | 800000 |
Option
Excel Version: |
downloads
如果这不是您想要的 Demo,您可以通过填写表格获取免费定制 Demo。
如您有与我们产品相关的其他技术问题,请联系 该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。;销售相关的问题,请联系 该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。。
Tab 2
using System.Data;
using Spire.Xls;
namespace DemoOnlineCode
{
class MarkerDesigner
{
public void demoMarkerDesigner(string filePath,string dataFilePath,string resultFilePath)
{
Workbook data_book = new Workbook();
data_book.LoadFromFile(dataFilePath);
DataTable table = data_book.Worksheets[0].ExportDataTable();
Workbook workbook = new Workbook();
workbook.LoadFromFile(filePath);
Worksheet sheet = workbook.Worksheets[0];
Worksheet sheet2 = workbook.Worksheets[1];
sheet.Name = "Result";
sheet2.Name = "DataSource";
sheet2.InsertDataTable(table, true, 1, 1);
workbook.MarkerDesigner.AddParameter("Variable1", 1234.5678);
workbook.MarkerDesigner.AddDataTable("Country", table);
workbook.MarkerDesigner.Apply();
sheet.AllocatedRange.AutoFitRows();
sheet.AllocatedRange.AutoFitColumns();
workbook.SaveToFile(resultFilePath, ExcelVersion.Version2010);
}
}
}
Tab 3
Imports System.Data
Imports Spire.XLS
Namespace DemoOnlineCode
Class MarkerDesigner
Public Sub demoMarkerDesigner(filePath As String, dataFilePath As String, resultFilePath As String)
Dim data_book As New Workbook()
data_book.LoadFromFile(dataFilePath)
Dim table As DataTable = data_book.Worksheets(0).ExportDataTable()
Dim workbook As New Workbook()
workbook.LoadFromFile(filePath)
Dim sheet As Worksheet = workbook.Worksheets(0)
Dim sheet2 As Worksheet = workbook.Worksheets(1)
sheet.Name = "Result"
sheet2.Name = "DataSource"
sheet2.InsertDataTable(table, True, 1, 1)
workbook.MarkerDesigner.AddParameter("Variable1", 1234.5678)
workbook.MarkerDesigner.AddDataTable("Country", table)
workbook.MarkerDesigner.Apply()
sheet.AllocatedRange.AutoFitRows()
sheet.AllocatedRange.AutoFitColumns()
workbook.SaveToFile(resultFilePath, ExcelVersion.Version2010)
End Sub
End Class
End Namespace