Tag: performance

从一个范围复制样式到另一个范围?

我有一个excel文件,我用它作为模板,在需要时添加信息。 我有特殊的风格和合并,需要在几个单元格范围内完成,但是我现在正在做的方式(bruteforcing它)是非常缓慢的,当有大量的数据。 有没有办法我可以做得更好? for a in xrange(1, len(plans)): offset = 3 * a # Create blank templates for plans for x in xrange(5, 549): first_col_cell = recommended.cell(row=x, column=4) second_col_cell = recommended.cell(row=x, column=5) third_col_cell = recommended.cell(row=x, column=6) new_first_col_cell = recommended.cell(row=x, column=4 + offset) new_second_col_cell = recommended.cell(row=x, column=5 + offset) new_third_col_cell = recommended.cell(row=x, column=6 + offset) if […]

如何减less程序执行时间,提高整体性能?

我已经创build了一个Windows应用程序来处理一个文件夹中的一组excel文件,从它们中寻找一些select性的信息。 之后,它将所有这些信息存储到一个新的Excel表单中。 这是一种报告生成工具。 我正在努力减less这个应用程序的总体执行时间。 目前,总共需要大约45-50秒完成一个成功执行周期。 代码与此类似: PS由于限制政策,我无法分享实际的代码。 但是下面显示的代码足以提供一些解决scheme。 #region master_tracking_sheet public string[] xlsfiles; public string[] personList = new string[35]; public string[,] excelSheet_det = new string[35, 6]; private void buttonBrowseFolder_Click(object sender, EventArgs e) { if (folder_browse_excelSheet.ShowDialog() == DialogResult.OK) { this.txt_DirPath.Text = folder_browse_excelSheet.SelectedPath; gotFile = true; } } private void btnCreateMasterSheet_Click(object sender, EventArgs e) { try { […]

Excel数据在Dashing仪表板上的表格?

我一直在试图转换一个叫做spreadsheetDemo的Dashing小部件,以便使用Roo GEM来简化它,并且允许它支持本地和Google Doc Excel文件(就像Roo一样)我开始通过查看其他小部件和源代码(类似于这只是一个表,而不是图)已经使用Roo,我试图重用他们的代码的文件来源代替原来的,导致我的代码如下。 我正在尝试使用Roo访问本地电子表格,获取6列和行的标题和数据,然后将它们推送到表中。 我相信我的问题可能在于正确访问电子表格。 一切都在第一个工作簿上,并从单元格A1开始。 我使用的来源:https:// github.com/Shopify/dashing/issues/78#issuecomment-14940695 http:// stackoverflow.com/questions/29400811/use-with-excel-data-to-display-on-dashing-dashboard/29421179?newreg=5c8c7db27d104f5ab3b855c8ea729bc8 require 'roo' #Tried using roo-xls as it started throwing errors saying I needed too. #require 'roo-xls' EM.kqueue = EM.kqueue? file_path = "#{Dir.pwd}/spreadsheet.xls" def fetch_spreadsheet_data(path) s = Roo::Excel.new(path) ws = workbook.sheets[0] # create an array to hold the lines rows = Array.new header = Array.new […]

性能下降设置Excel工作表打印设置

使用用于Excel的Microsoft Office Interop库,我已经在VB.Net中编写了一个例程,它创build了大量的Excel工作表,然后填充它们,然后格式化它们进行打印。 对于每个工作表,我称这个小方法来设置打印设置: Public Sub SetDefaultReportPrintSettings(orientation As ReportSheetOrientation, ws As Excel.Worksheet) CType(ws.Parent, Excel.Workbook).Application.Windows(1).Zoom = 90 With ws.PageSetup Select Case orientation Case ReportSheetOrientation.Portrait : .Orientation = Excel.XlPageOrientation.xlPortrait Case ReportSheetOrientation.Landscape : .Orientation = Excel.XlPageOrientation.xlLandscape End Select .Zoom = False .FitToPagesTall = 1 .FitToPagesWide = 1 .LeftMargin = ws.Application.InchesToPoints(If(orientation = ReportSheetOrientation.Portrait, 0.75, 0.5)) .RightMargin = ws.Application.InchesToPoints(0.5) .TopMargin […]