/android-spreadsheet-lib

Automatic creation of two-dimensional scrollable array

Primary LanguageJavaApache License 2.0Apache-2.0

Android Spreadsheet

Automatic creation of two-dimensional scrollable spreadsheet for Android. The spreadsheet is automatically generated, any entity can be diplayed. No extends is needed. The library is using annotations android processor to generate the array. No reflection API is used at runtime. The library requires at least Android 1.6 Donut (API level 4).

Add Dependencies

Gradle dependencies

compile 'fr.nelaupe:spreadsheet:1.1.1@aar'
compile 'fr.nelaupe:spreadsheet-compiler:1.1.1'

Sample

Result

Create your entity

public class Person {
	
    @SpreadSheetCell(name = "ID", size = 100, position = 1)
    private Integer id;

    @SpreadSheetCell(name = "First Name", size = 300, position = 2)
    private String firstName;

    @SpreadSheetCell(name = "Last Name", size = 300, position = 3)
    private String lastName;

    @SpreadSheetCell(name = "city", size = 300, position = 4)
    private String city;

    @SpreadSheetCell(name = "Company", size = 300, position = 5)
    private CustomCompany company;

    @SpreadSheetCell(name = "Birth date", size = 300, position = 6)
    private String birthday;

    @SpreadSheetCell(name = "Email", size = 300, position = 7)
    private String email;

    @SpreadSheetCell(name = "M", size = 80, position = 8)
    private boolean gender;

}

Layout

<fr.nelaupe.spreadsheetlib.SpreadSheetView
	android:id="@+id/spread_sheet"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    sheet:headerColor="#009FFF"
    sheet:headerRowHeight="50dp"
    sheet:headerTextColor="#FFFFFF"
    sheet:headerTextSize="17sp"
    sheet:minFixedRowWidth="80dp"
    sheet:rowHeight="50dp"
    sheet:textColor="@color/text"
    sheet:textPaddingLeft="15dp"
    sheet:textSize="15sp"
    />

Activity

SpreadSheetAdaptor adaptor = new SpreadSheetAdaptor(context);
// Fill data

SpreadSheetView spreadSheetView = (SpreadSheetView) findViewById(R.id.spread_sheet);
spreadSheetView.setAdaptor(adaptor);
spreadSheetView.invalidate();

Contributor

License

Licensed under the Apache License, Version 2.0