I want to add a pdf file to the Flexgrid table. Previously, I added an image using
B4X:
if_flexgridtabledetailslist.TypeImage
But Now I don't know how to add the Pdf file. I have to convert the pdf file into bytes, encode, and then save it to the database. Please Note that I have to add more than 2 rows.
You can use flexgrid.TypeString to refer to the name of the pdf file and associate it by a map where the key is the String content of the grid cell
and the value is the location (URL) of pdf, then use the flexgrid_CellClick event to get the name of the pdf file, get its URL and display it using intent.
Otherwise one has to modify the flexgrid library to include a flexgrid.Typehyperlink since, as I think, it can not store binary data in its cells:
B4X:
Dim pdfMap as Map= CreateMap("doc1.pdf":"c:\documents\doc1.pdf","doc2.pdf":"c:\documents\doc2.pdf","doc3.pdf":"c:\documents\doc3.pdf")
'
'
'
'
Sub flexgrid1_CellClick(Row As Int, Col As Int)
Dim S As String = FlexGrid1.GetCellValue(Row,Col)
Dim pdfUrl as string = pdfMap.Get(S)
Dim intent As Intent
intent.Initialize(intent.ACTION_VIEW, pdfUrl)
intent.SetType("application/pdf")
StartActivity(intent)
End If
End Sub