Given:

There is a database in the application for android. OrmLite is used to work with it.

Task:

It is necessary to see it, the base, the contents in the form of Excel tables for debag.

What is done:

Google does not help much in this. All that he gave me is a link that describes how to convert the database table to a .CSV file and send it by mail. After jumping a little with a tambourine, I managed to send all my tables as files to the mail and manually convert them to .xls tables.

Question:

Is there a way to further optimize / automate the process? Ideally, I would like to convert database tables into Excel tables directly in the application. Well or .csv files in Excel spreadsheets. At the same time, you have to manually open .csv files and convert them to * .xls by poking into the "next" button on your computer in Excel.

UPD_0:

Under the link @Suvitruf , it seems as that that is necessary, but very big. Immediately received over65K methods and +6 MB in project weight. If there isn’t anything “easier” I’ll use a separate application and write here in the answer, briefly, how to use it.

  • one
  • @Suvitruf, thank you, it seems like what you need, but ... But I started testing and first got a lack of memory from Eclipse, then an excess of 65K methods (Judging by the fact that googled, google for solving this problem will work only in AndroidStudio. In general, are there any fewer for export to xls in smaller size? =) I don’t need to buy more operatives, but go to the “studio”))) - Juriy Spb
  • @Yuriy SPb lack of eclipse is treated by changing the launch settings in the config. 65k methods are treated with a proguard) - Suvitruf
  • @Suvitruf, thank you, the memory shortage has already been cured, I'll do it with methods. Googled that you can cut your hands like that with Google services ... O ad! I just wanted to get the 3rd file (((( YuriySPb
  • @YuriySPb we are not looking for easy ways = D - Suvitruf

1 answer 1

As mentioned in the question, the link @Suvitruf is available for working with XLS files. Here is an example:

File exportDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), ""); String path = exportDir.getCanonicalPath(); //Instantiate a Workbook object. Workbook workbook = new Workbook(); //Get the first worksheet's cells in the book. Cells cells = workbook.getWorksheets().get(0).getCells(); //insert column names int columnQuont=3; for (int i = 0; i < columnQuont; i++) { cells.get(0, i).setValue("название_колонки"); } for (int i = 0; i < columnQuont; i++) { String data = "что-нибудь"; cells.get(1, i).setValue(data); } //Save the Excel file. workbook.save(path + "/ArticleXLS.xls"); 

Accordingly, you just need to collect data from the database and write them to a file.

True, either this fee. Price - $ 999 (sic!) Or the maximum number of allowed methods in the android application in rubles at the current rate. You can download it by reference, but it’s not very clear what its use is fraught with not for testing purposes, except for adding a page in the final file with the inscription:

Evaluation Only. Created with Aspose.Cells for Android.Copyright 2003 - 2015 Aspose Pty Ltd.

PS In total, the problem is solved if we consider it in a broader sense and google instead of the one mentioned in the title of the question

android xls library

What gives open source lib and an example of its use .

  • @Expert, can I somehow accept my answer? .. - Yuriy SPb
  • @YuriSPb possible, but not immediately. If no one takes him for you, then two days later - andreich
  • @Andreich, understood, thank you) And @Expert of the same) - YuriiSPb