Is there a way to export a txt file in a cell like an image with AG Grid's excel export function? - ag-grid

I see a lot of information about exporting an image (jpg, png, gif) to an excel file with AG Grid, but nothing on something like a txt file. I am trying to get the contents of a txt file into a cell like an image can. My txt file is converted (just like an image) to base64, and I am using it in a UI to display its contents.
Does anyone know if/how AG Grid can export this kind of data?
Ex: data:text/txt;base64,... works in my UI just like data:image/png;base64,... but in AG Grid I am only able to export the image and not that txt file.

So I found that all I have to do to display the contents of the log file (logFile) (which I pull from my Postgres DB as Bytea) is run that through String.fromCharCode(logFile) and throw that in AG Grid as a multiline entry.

Related

How to extract texts from images in a folder

My laptop is Ubuntu, I have a folder called testdata which contains lots of jpg images, I want to know how to run Tesseract on all these images and save outputs to another folder e.g. "testresult". Outputs can be a single txt file contains extract texts from all images. Or, it can be one txt file for one image extracted text only.
For a single image, the command line I know is tesseract test_01.jpg test_01
Could anyone help me please?

How to save/export array as PDF in MATLAB

I have a large cell array which I want to export as report-like format. Is it possible to export arrays (strings and numbers) as a PDF file?
For example, say I have this cell array
data = {'Frank' 'Diana' '06-May-2018'}
and I want to export the this array content to a PDF file. In this case it should simply create a PDF file with the text:
Frank Diana 06-May-2018
The only way I know of for MATLAB to generate a PDF file is through a figure window. You can write text to a figure window, and print it to a PDF file:
fh = figure;
ah = axes('parent',fh,'position',[0,0,1,1],'visible','off',...
'xlim',[0,1],'ylim',[0,40],'ydir','reverse',...
'fontsize',14);
text(0.01,1,'text line 1','parent',ah);
text(0.01,2,'text line 2','parent',ah);
print(fh,'-dpdf','output.pdf')
The MATLAB File Exchange has a bunch of submissions that can help you print text to a figure window. Search for the tag "fprintf".
An alternative solution is to write the data to e.g. a Word document, or a Markdown or LaTeX file, and call appropriate programs from within MATLAB to convert those to PDF. The File Exchange has a submission to control Word. The pandoc or pdflatex external programs can be invoked through the ! or system functions.
Yes, easiest is use Matlab Notebook. Make it as pretty as you like.
Suggest to remove matlab-guide tag from your question, doesn't belong there.

how can read text data from excel in matlab?

i want to read text and numbers from an excel file. when i write the code as below it can not read the text data from excel file. how can i fix it? thank for taking your time.
data = xlsread('normalize.xlsx');
the picture of excel file is here:
and the picture of data that created from the code is hear:
'xlsread' and 'csvread' are both for reading numeric data in MATLAB. If you are on a Windows platform and have Microsoft Excel installed, you can use the following syntax with 'xlsread' to read your data into two cell arrays:
[num_data string_data] = xlsread('normalize.xlsx');
You will have the text column in your data in the string_data array. The corresponding column in num_data will still have NAN.

Importing data from text file and saving the same in excel

I am trying to read data from text file (which is output given by Tesseract OCR) and save the same in excel file. The problem i am facing here is the text files are in space separated format, and there are multiple files. Now i need to read all the files and save the same in excel sheet.
I am using MATLAB to import and export data. I even thought of using python to convert the files into CSV format so that i can easily import the same in MATLAB and simply excelwrite the same. But no good solution.
Any guidance would be of great help.
thank you
To read a text file in Matlab you can use fscanf or textscan then to export to excel you can use xlswrite that write directly to the excel file.

Create Excel file in iPhone programmatically

I want to create a Excel supported file which contains strings and images programmatically. I tried to create a .csv file, but I am not able to .csv file with both string and image.
There are many possibilities. The easiest way is to create CSV-Files but you have to take care which seperators excel uses. For checking that you should create a spreadsheet in excel and save it as csv and take a look into that file using any text-editor.
Another approach is to use SpreadsheetML and here a link to the msdn XML Spreadsheet Reference
Otherwise just create a simple xlsx-file with excel, unzip that file and take a look into that the unziped files.