Report / word doc output ?

ljcomp

Member
Licensed User
Longtime User
Hi All
I am writing an app for a tablet using sqlite database to capture survey data in the field. I want to then create a report having words and tables, most of which is static but some need to be replaced by relavent fields from a data set.

The database is working well but I have no idea how to progress.

Ie If I have a word doc like:-

"We have been instructed by ****** to carry out a survey"
I would want to insert the ****** text from a database col.

I have a table of 2 cols and 3 rows, in each box I would want to insert a number then the value from a database

When the form / report / word doc whatever is completed I need to print it or send it to a pc for printing.

If this makes sence to anyone would you please point me in the right dirrection.

Many thanks

Lj
 
Wow that was quick mate
Having a blonde moment, how would I open and edit the HTML from basic4android ?

I assume I create the HTML outside of basic4android. Open the file with my app and input varriable data. Then show the file in a webview.

LJ
 
Upvote 0
Thanks for that, Problem I got is the size of the html page I need to generate.
Is there a way to write mutilpe lines of html.
ie in PHP I can use
ECHO <<<END
html 1
html 2
etc
etc
END

LJ
 
Upvote 0
No, but you could read the contents of your HTML and then "replace" the fields you need, for example:
Code: Copy
<html>
<body>

<table border='1'>
  <caption>User Info</caption>
  <tr>
    <th>User Info</th>
    <th>Data</th>
  </tr>
  <tr>
    <td>First Name</td>
    <td>$First</td>
  </tr>
  <tr>
    <td>Last Name</td>
    <td>$Last</td>
  </tr>
</table>

</body>
</html>

Then you could do this:
Code: Copy
HTML = HTML.Replace("$First", Main.FirstName)

You can create your HTML with an editor, do you get the idea?
 
Last edited:
Upvote 0
Ah thats looking more usable..

Assuming I could read the html file into HTML with
Code: Copy
 HTML = File.OpenInput(File.DirRootExternal & "/treescape/","bs.html")

Failed with (BufferedInputStream) java.io.BufferedInputStream@4077de8

Any idea what this means ?

My first thought was HTML file too large, it's about 1MB inc images.
 
Upvote 0
Many thanks mate
I was almost there should have used
Code: Copy
HTML = File.GetText(File.DirRootExternal & "/treescape/","bs.html")

Works a treat except for no images show in the webview.
Will check my html and the image folder.

LJ
 
Upvote 0
Thanks for that
Looks like I can use what I have learned so far to text replace in the html file.
Then save the new html as a new file. Assuming the img tags of the html are not altered, the new file should render correctly in a browser.

LJ
 
Upvote 0
Back
Top