protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
817 stars 417 forks source link

Extra rows for nested data? #72

Open balbinas opened 7 years ago

balbinas commented 7 years ago

Hello, I've implemented the package with no problem except for the fact that I have this json data:

var data = [
    {
      "jobsiteId": 2,
      "jobsiteCode": "0065006470",
      "jobsiteDesc": "BALCONES DE MORELOS SERVER II",
      "latitude": 27.333333333333,
      "longitude": -102,
      "altitude": 0,
      "favoriteStatus": "Y",
      "measureUnit": "M3",
      "isJobsiteActive": true,
      "orders": [
        {
          "orderId": 2911,
          "totalLoads": 3,
          "totalDeliveries": 0,
          "totalQuantity": 21,
          "deliveredQuantity": 0,
          "programedDateTime": "2017-04-06T16:30:00",
          "orderStatus": "Active",
          "orderStatusGroupCode": "NST",
          "isReadyMix": true,
          "pointOfDeliveryId": 2
        },
        {
          "orderId": 2938,
          "totalLoads": 6,
          "totalDeliveries": 1,
          "totalQuantity": 42,
          "deliveredQuantity": 7,
          "programedDateTime": "2017-04-07T00:00:01",
          "orderStatus": "In Progress",
          "orderStatusGroupCode": "STR",
          "isReadyMix": true,
          "pointOfDeliveryId": 2
        },
        {
          "orderId": 2958,
          "totalLoads": 6,
          "totalDeliveries": 0,
          "totalQuantity": 42,
          "deliveredQuantity": 0,
          "programedDateTime": "2017-04-07T00:00:01",
          "orderStatus": "In Progress",
          "orderStatusGroupCode": "STR",
          "isReadyMix": true,
          "pointOfDeliveryId": 2
        },
        {
          "orderId": 2959,
          "totalLoads": 3,
          "totalDeliveries": 0,
          "totalQuantity": 21,
          "deliveredQuantity": 0,
          "programedDateTime": "2017-04-07T00:00:01",
          "orderStatus": "In Progress",
          "orderStatusGroupCode": "STR",
          "isReadyMix": true,
          "pointOfDeliveryId": 2
        }
      ],
      "pointofDeliverys": [
        {
          "pointOfDeliveryId": 2,
          "pointOfDeliveryCode": "0065006470",
          "pointOfDeliveryDesc": "BALCONES DE MORELOS SERVER II"
        }
      ]
    }
]

And the excel is exporting it like this: screen shot 2017-06-13 at 4 33 41 am

So my question is: is there a way where I could repeat the rows with the same Jobsite for each individual order? or just separate them even if the rest of the row is blank?

Thank you!