filmov
tv
How to create an Excel file from your Android App?

Показать описание
It hard-codes the file name and sheet name in the code. However, that can be taken as an input from the user.
For the content it takes the input from the user through an Edit Text widget. Though it uses a single line edit text but same can be done using a multi-line plain text (Edit text) user input.
It creates the file in the emulator's external storage. However, any location on the mobile device can be used to create the file.
Complete source code and other details can be found in the below link:
However, the main Java code is copied below also for reference:
import android.Manifest;
public class MainActivity extends AppCompatActivity {
private EditText editTextExcel;
@Override
protected void onCreate(Bundle savedInstanceState) {
}
public void buttonCreateExcel(View view){
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
try {
}
FileOutputStream fileOutputStream= new FileOutputStream(filePath);
if (fileOutputStream!=null){
}
} catch (Exception e) {
}
}
}
Комментарии