Skip to content

Black sheet error #18

Closed
Closed

Description

@raphaelmtro

Hi, I just start working with this package and seems to be a great work. However, after updating a few cell with app and asking to save the on progress data to a sheet I never get the task done. The result is always a blank sheet.

Currently II'm developing an app for desktop with Flutter. I had no intention to build mobile versions for this app.

I'm working on macOS but have have easy on switching to any other OS. Here's the snippet from wen I try to sae the data:

/// Save workbook data to a file
  void save(String directoryPath, List<CodeModel> validatedCodes) {
    final sheet = _workbook.worksheets[0];

    var globalStyle = _workbook.styles.add('style');
    globalStyle.backColor = '#37D8E9';
    globalStyle.fontName = 'Times New Roman';
    globalStyle.fontSize = 20;
    globalStyle.fontColor = '#C67878';
    globalStyle.italic = true;
    globalStyle.bold = true;
    globalStyle.underline = true;
    globalStyle.wrapText = true;
    globalStyle.hAlign = HAlignType.left;
    globalStyle.vAlign = VAlignType.bottom;
    globalStyle.rotation = 90;
    globalStyle.borders.all.color = '#9954CC';

    for (int row = 1; row == validatedCodes.length; row++) {
      for (int column = 1; column == 4; column++) {
        sheet.getRangeByIndex(column, row).cellStyle = globalStyle;
        sheet.getRangeByIndex(column, row).setText('Hello world');
      }
    }

    List<int> bytes = _workbook.saveAsStream();
    File(join(directoryPath, 'validated-codes.xlsx')).writeAsBytes(bytes);

    //Dispose the workbook.
    _workbook.dispose();
  }

Here is the blank sheet result:

Screen Shot 2020-10-14 at 16 40 23

flutter doctor -v

[✓] Flutter (Channel master, 1.23.0-8.0.pre.27, on Mac OS X 10.15.6 19G2021 x86_64, locale en-BR)
    • Flutter version 1.23.0-8.0.pre.27 at /opt/flutter
    • Framework revision 8db31a556b (2 weeks ago), 2020-09-28 14:32:00 +0200
    • Engine revision 3a73d073c8
    • Dart version 2.11.0 (build 2.11.0-161.0.dev)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/rafael/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio 2.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Community Edition (version 2020.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin installed
    • Dart plugin version 202.7319.5

[✓] Connected device (3 available)
    • macOS (desktop)  • macos      • darwin-x64     • Mac OS X 10.15.6 19G2021 x86_64
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 85.0.4183.121

• No issues found!

Activity

  1. Sridhar-Sukumar commented on Oct 15, 2020

    @Sridhar-Sukumar

    Hi Rafael,

    Thank you for using Syncfusion products.

    We have analyzed your code and found that the condition used in the FOR loop is not correct. We request to use the below conditions to resolve the issue.

    for (int row = 1; row <= validatedCodes.length; row++) {
      for (int column = 1; column <= 4; column++) {
        sheet.getRangeByIndex(row, column).cellStyle = globalStyle;
        sheet.getRangeByIndex(row, column).setText('Hello world');
      }
    }
    

    Regards,
    Sridhar

  2. raphaelmtro commented on Oct 15, 2020

    @raphaelmtro
    Author

    It worked smoothly. Thanks a lot. It's the final step for completing my project. It really helped me a lot. I will look forward contributing in some way with this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions