Home > Back-end >  C builder how to turn the fixed format of word to execl file, such as online
C builder how to turn the fixed format of word to execl file, such as online

Time:09-29

Now have word version multiple-choice questions, I want to put all the choice import into execl, format as follows: the first column item number, the second column content the third column option A
, the fourth column B,,, the last column is the answer, a a copy too much trouble, use program how to implement, a great god please help! Item as shown in figure format

CodePudding user response:

How no one? Great god? Old demon

CodePudding user response:

The copy documents first in a string w, the output to an array of xx. Try to output to Excel.

AnsiString w="1. The numerous and complicated a. messy b. c. profusion multifarious d. mixed 2. Whitewash a. b. painting decoration c. hide d. decoration 3. () carefully, will find the two pictures the nuances of a. watch b. appreciate c. compare d. check... ";
AnsiString xx [100] [6].
Int n, a, b, c, d, ll;
For (int I=1; N> 0; I++)
{
Ll=w. ength ();
N=w.P OS (". ");
A=w.P OS (" a. ");
B=w.P OS (" b. ");
C=w.P OS (" c ");
D=w.P OS (" d. ");
Xx [I] [0]=IntToStr (I);
Xx [I] [1]=baron ubString (n + 1, a - n - 1). The Trim ();
Xx [I] [2]=baron ubString (a, b - a). The Trim ();
Xx [I] [3]=baron ubString (b, c - b). The Trim ();
Xx [I] [4]=baron ubString (c, d - c). The Trim ();
N=w.P OS (IntToStr (I + 1));
Xx [I] [5]=(n==0)? Ll, baron ubString (d - d). The Trim () : baron ubString (d, n - d). The Trim ();
W=baron ubString (n, ll - n);
}
  • Related