Tag: multidimensional array

将大块数据导出到Excel

我想导出一个2-D数组,以便在List<DataSet>包含大量的数据。 如果我将DataSet分成每个DataSet有5000行的块,每个DataSet包含66个字段, WorkSheets在单个WorkBook有60多个WorkBook 。 我理想的是能够将我的List<DataSet>对象中的每个Table中的数据追加到单个WorkSheet 。 如果这是可能的话,我需要一些帮助来获得解决scheme。 使用包含该大小matrix的单个DataSet分配Excel.Range会导致System.OutOfMemoryException 。 以下是我目前如何将我的DataTable分成块: internal static class ExtensionMethods { internal static List<DataTable> SplitDataSetIntoMultipleTables(this DataTable tableToClone, int countLimit) { List<DataTable> tables = new List<DataTable>(); int sheetNumber = 0; DataTable copyTable = null; foreach (DataRow dr in tableToClone.Rows) { if ((count++ % countLimit) == 0) { sheetNumber++; copyTable = new DataTable(); […]

用另一个数组sortingmultidimensional array,并以相同的顺序完成丢失的键

我试图使用PHP / Laravel将导出表中的数据导出为ex​​cel,可以自定义导出表以显示特定列,导出列应与表列相同。 问题是 – 如果列不存在于一个特定的行中,列不显示为空,'xls'文件导出非常混乱…我的代码如下所示: public function excelExport(Request $request, $client_id=null) { $client_id = is_null($client_id) ? \Auth::client()->id : $client_id; if(is_null($this->client_users)){ $this->client_users = $this->clientsController->listClientUsers($client_id); } $columns = $this->account_settings->getColumnsDef($client_id); $query = Lead::select(array_keys($columns))->where('client_id',strval($client_id))->where('deleted',0); $query = $this->setQueryDates($request,$query,$client_id); $query = $this->leadsFiltersController->setExportQuery($request,$query); $arr = $query->get()->toArray(); Excel::create('leads' , function($excel) use ($arr,$columns){ $excel->sheet('Leads' , function($sheet) use ($arr,$columns){ $rows = []; $count = 0; […]

使用PHP Excel Libraryparsing复杂的Excel文件并检索电子邮件模板的数据

我想使用PHP Excel Libraryparsing下面的excel文件,并将数据放入电子邮件模板(PFA)中。 这里是parsing数据的相应代码: // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($target_file); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($target_file); } catch(Exception $e) { die('Error loading file "'.pathinfo($target_file,PATHINFO_BASENAME).'": '.$e->getMessage()); } // Get worksheet dimensions $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // Loop through each row of the worksheet in […]

基于input的dynamicexcel数组

我正在寻找一个在Excel中做一个基于公式的dynamic数组的帮助。 KPI | Tgt | 数字| 重量 FCR | 0%| 1 | 45% FCR | 60%| 2 | 45% FCR | 80%| 3 | 45% 信息| 45%| 4 | 25% 信息| 50%| 5 | 25% 信息| 200%| 6 | 25% 磨损| 8%| 7 | 10% 磨损| 12%| 8 | 10% 磨损| 100%| 9 | 10% […]

使用Excel VBAparsing多级XMLinput

一般来说,需要使用Excel VBA从XMLparsing符合某些过滤条件的input。 复杂性在于多级XML属性及其配对结果,必须在Excel内依次填充。 XML内容如下: <Flow index="1" item="1" itemName="BB_150" ID="XXX"> <Attribute name="FUNCTIONAL_X" dataType="Double" unit="" multiplier="" tag="YY">1</Attribute> <Attribute name="X_LOC" dataType="String" unit="" multiplier="" tag="YY">2</Attribute> </Flow> <Flow index="2" item="2" itemName="CC_200" ID="WWW"> <Attribute name="FUNCTIONAL_X" dataType="Double" unit="" multiplier="" tag="YY">15</Attribute> <Attribute name="X_LOC" dataType="String" unit="" multiplier="" tag="YY">3</Attribute> </Flow> <Flow index="3" item="3" itemName="DD_200" ID="UUU"> <Attribute name="FUNCTIONAL_X" dataType="Double" unit="" multiplier="" tag="YY">20</Attribute> <Attribute name="X_LOC" dataType="String" unit="" […]

java.lang.ArrayIndexOutOfBoundsException:难以找出发生错误的位置

我正在尝试编写一个基本的Java程序,它从Excel电子表格中收集数据并将其存储在一个数组中。 我遇到的问题是我得到ArrayOutOfBoundsexception,但不能看到我的数组的界限以外的地方。 我甚至有意将数组的尺寸设置为比循环终止值大得多: import java.io.File; import java.io.IOException; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; public class InputArray { public static void main(String[] args) { String[][] InputArray1; int i = 0; int j = 0; InputArray1 = new String[220][220]; try{ Workbook OLE1Shots = Workbook.getWorkbook(new File("C:/Book12.xls")); Sheet inList = OLE1Shots.getSheet(0); for (i = 0; i < […]

将Excel表转换为2d数组

我有第一列中的date的下一个Excel表和其他一些数据(B,C)。 1。 2。 我想把它转换成表格,如图3: 要做到这一点,你需要在一个小时内把每行和每列的数据加起来(不知道怎么说),并乘以2400.例如,从第一张图片我们有(0.0022 + 0.0078 + 0.0021 + 0.0078 )* 2400≈47 – 从第三张图片的表格的第一个元素。 我试图用PHPExcel库做到这一点: $objPHPExcel = new PHPExcel(); $objPHPExcel = PHPExcel_IOFactory::load("data.xlsx"); $highestRow = $objPHPExcel->getActiveSheet()->getHighestRow(); $day = 1; $hour = 1; $data = array(array()); for ($i = 1; $i < $highestRow + 1; $i++) { $cell1 = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(1, $i)->getValue(); $cell2 = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(2, $i)->getValue(); $data[$day][$hour] […]

用作翻译的二维数组复制和粘贴行

我有一个电子表格,调出代理分配的工作。 “代理ID”在列A中,数据在列AM中。 我为每位代理的主pipe(主pipe姓氏)分别填写单。 我很难将代理ID编码到macros中,但是我想使它工作,以便我可以从翻译表中提取数据,翻译表只能包含代理ID和相应的主pipe姓。 我不知道如何逐行parsing数据,find代理ID,然后将该行复制到相应的工作表。 我已经有了AgentID,Supervisor的翻译单(名为sup-agent_Trans) 就是这两列。 这是我到目前为止: Dim varList As Variant Dim lstRowTrans As Long Dim lstRowRework As Long Dim rngArr As Range Dim rngRwk As Range Dim row As Range Dim cell As Range Application.ScreenUpdating = False lstRowTrans = Worksheets("Tech-Sup_Trans").Cells(Rows.Count, "A").End(xlUp).row lstRowRework = Worksheets("Rework").Cells(Rows.Count, "A").End(xlUp).row varList = Sheets("Tech-Sup_Trans").Range("A1:B" & lstRowTrans) Set rngRwk = […]

在Excel中从2d数组获取行和列总计

我想知道如何从Excel中的二维数组中获取行和列总计。 这是一个相当普遍的事情要做,但我无法通过search行和列总计find答案,所以我认为这将是值得发布它作为一个问题。 假设我想要在单元格A1:D3中find以下数组中最低的列总数和最高的行数: 1 2 3 4 5 6 7 8 9 10 11 12 我最初的想法是沿着 =min(A1:D3*(column(A1:D3)={1,2,3,4})) 但这种简单的方法是行不通的。 我记得读过,在这些情况下,你必须使用mmult,并看到使用它们的先进的公式,但不知道如何。 我会尽量回答我自己的问题,但其他的build议是值得欢迎的。

PHP:使用foreach修改multidimensional array的值

我有一个使用Yii2的项目,在我的项目中用户可以上传一个excel文件,系统读取数据并将其设置成一个新的二维数组,例如: Example.xls 这是我在我的控制器中使用的代码: for ($row = 1; $row <= $highestRow; ++$row) { $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); if (!is_null($rowData[0][0])) { foreach ($rowData as $key => $value) { foreach ($value as $vKey => $vValue) { $tempArrayData[] = $vKey . "_" . $vValue; } } $arrayData[] = $tempArrayData; […]