为Excel 2003小号preadsheet代使用模板来格式化.NET组件 [英] .NET Component for Excel 2003 spreadsheet generation using templates for formatting
问题描述
我的应用程序试图解决的问题是这样的:
The problem my application is trying to solve is this:
目前,一些存储过程运行,数据手动复制出来的SQL结果到一个空白US preadsheet和报告分析师格式化数据。这个过程被认为太长时间和昂贵的。
Currently, several stored procedures are run, the data is manually copied out of the SQL results into a blank spreadsheet, and reporting analysts format the data. This process has been deemed too long and costly.
理想的解决方案(在我心中)是一个.NET应用程序的组件,可以采取一个存储过程的结果,并将其写入到特定的单元格区域中的工作表模板(模板保持格式化),然后我可以整理结果到了.NET应用程序的工作簿。
The ideal solution (in my mind) is a .NET application with a component that can take a stored procedure result and write it to a specific cell range in a worksheet template (maintaining template formatting) and then I can just collate the results into workbooks in the .NET application.
有没有这样的应用程序在那里?更妙的是,没有任何人有没有更好的办法?
Are there any such applications out there? Even better, does anyone have any better solutions?
感谢您的考虑。
推荐答案
我用什么来设置数据
获取数据的形式
object[,] excelSpreadsheetData
然后通过设置应用数据
then apply the data by setting
public void SetWorksheetData(long rowCount, long columnCount, object[,] excelSpreadsheetData, int startingRow, int startingCol, Worksheet worksheet)
{
if (rowCount == 0 || columnCount == 0) return;
//set the region data.
object m_objOpt = Missing.Value;
Range cellRange = worksheet.get_Range(ExcelGeneratorUtils.ExcelColumnFromNumber(startingCol) + startingRow, m_objOpt);
cellRange = cellRange.get_Resize(rowCount, columnCount);
cellRange.set_Value(m_objOpt, excelSpreadsheetData);
}
这应该保持模板格式,并设置在一气呵成的数据,速度远远超过设置它的细胞,通过细胞。
This should keep the template formatting, and sets the data in one go, much faster than setting it cell, by cell.
希望帮助
这篇关于为Excel 2003小号preadsheet代使用模板来格式化.NET组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!