Skip to content

Commit

Permalink
fix(QualisudExporter): exporte en Excel
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed May 16, 2024
1 parent 5167dff commit c1c418d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/Features/ExportStrategies/QualisudExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fromCodeCpf } from '@agencebio/rosetta-cultures'
import { featureName, legalProjectionSurface } from '@/components/Features/index.js'
import BaseExporter, { generateAutresInfos } from "@/components/Features/ExportStrategies/BaseExporter.js";

const { aoa_to_sheet, sheet_add_aoa } = utils
const { aoa_to_sheet, book_append_sheet, book_new, sheet_add_aoa } = utils

/**
* @typedef {import('geojson').Feature} Feature
Expand Down Expand Up @@ -81,18 +81,16 @@ function getSheet () {

class BureauVeritasExporter extends BaseExporter {
label = 'Tableur'
extension = 'csv'
mimetype = 'text/csv'
extension = 'xlsx'
mimetype = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

getSheet = getSheet

toFileData() {
const sheet = this.getSheet()
const workbook = utils.book_new()
utils.book_append_sheet(workbook, sheet, 'Export CartoBio')
// Cette fonction ajoute un BOM ce que sheet_to_csv ne fait pas
const data = write(workbook, { type: "array", bookType: 'csv', FS: ';' })
return new Blob([data])
const workbook = book_new()
book_append_sheet(workbook, sheet, 'Export CartoBio')
return new Blob([write(workbook, { bookType: this.extension, type: 'array' })], { type: this.mimetype })
}
}

Expand Down

0 comments on commit c1c418d

Please sign in to comment.