U
U
User992018-03-29 15:19:29
Delphi
User99, 2018-03-29 15:19:29

How to write multiline text and formula to database table in defl?

Hello everyone! We need to make a program for passing the test. The question table must support multi-line text and a mathematical formula. Questions must be imported from Word documents.
What types of columns should be in order to support, for example, such text:


Question 1:
Calculate the area of ​​a rectangle whose length is 6 cm and width is 5 cm.
The program in the Pascal programming language:
Program pr; usescrt;
Var a,b,s:integer;
Begin clrscr;
a:=6;
b:=5 ;
s:=a*b;
Writeln ('Area of ​​rectangle S= ',s,'cm.sq');
readln;
end.
-------------------------------------------------- ----------------------
A) .....................
..... ..........
B).................................
.......... ....
C).................................
................ .............
D).......................
E).......... ..............

That is, questions and answers are multiline. It should also support formulas like this 5abcd9406803a285909257.png
. Tried in SQL Server, the data type is nvarchar(max), but the formulas turned into this form: (x+a)^n=∑_(k=0)^n▒〖(n¦k) x ^ka^(nk) 〗
Question 1) Which type to specify?
Question 2) How to work with this type? You can have a small example, I’ll pull it myself))
If you use a cipher. Is it possible to save formulas in such a type as in word?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
microfrog, 2018-03-29
@microfrog

Try to form questions and answers in RTF format (Wordpad). This format does not support formulas, but it does support tables and images (formulas).
Then, either through the program interface (copy/paste in TRichEdit), or through file upload, save to a table, in a varbinary type field. Accordingly, then when displaying the question, load from this field and display through TRichEdit.

K
Konstantin Tsvetkov, 2018-03-29
@tsklab

Questions must be imported from Word documents
Use an OLE container not "from" , but for . Store in varbinary(max).

K
kalapanga, 2018-03-29
@kalapanga

The database is the tenth thing here. First, decide what format can save all your Wishlist (formulas, fonts, pictures, something else). Then you look for which component can display this format. It is unlikely that you will write your own. Actually, that's all.
Is this some kind of learning problem? I would probably do this on RTF using native RichEdit or from Jedi VCL.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question