csv icon indicating copy to clipboard operation
csv copied to clipboard

Cant create more then 1 field per row

Open GustavoContreiras opened this issue 6 years ago • 1 comments

onPressed:  () async { 
                  //blocs.homePageBloc.onClickScheduleReview(); 
                  //Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => ScheduleReviewPage()));
                  
                    Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.storage]);
                    bool isShown = await PermissionHandler().shouldShowRequestPermissionRationale(PermissionGroup.storage);
                    String appDocDir;
                    await getTemporaryDirectory().then((onValue) {
                      appDocDir = onValue.path;
                    });
                    final res = const ListToCsvConverter().convert([['aaa', ',', 'ccc'], ['barra n \n']]);
                    print(greenPen("[HomePage] tempDir: " + appDocDir));
                    File f = new File(appDocDir + "b.csv");
                    f.writeAsString(res);
                    blocs.providers.databaseProvider.uploadFile(f, 'csv', "c", "nnn");
                },

Is the output right? Tried to follow the official example.

image

Edit: solved by using ';' but still have a problem with ','

image

Edit: solved by using field delimiter ';'

image

GustavoContreiras avatar Nov 30 '19 14:11 GustavoContreiras

Excel is a very bad CSV reader / writer.

I will however try to improve the default values in a future release.

(Excel is for instance still not able to read UTF8 encoded CSV without manual intervention.)

⇒ Leaving this issue open as a reminder to improve the default values (/ mentioning Excel somewhere)

close2 avatar Dec 03 '19 07:12 close2