Show Bid Request
Insert Table into RTF Document From C++
Bid Request Id: 426
|
|
|
Description:
I've written a windows application in MS Visual C++ that does text substitution on an RTF document. Currently it replaces constants such as ~101 with name, ~102 with address, ~115 with amount owed etc. This is fairly simple. I need to be able to insert a two column table in the middle of the the document that contains bulleted lists in each column in the same way.
Deliverables: details
In the middle of the document is an escape code like '~200' that needs to be replaced with a computer generated two column table with bulleted lists in each column. The contents of the table varies with each print of the document and is derived from a database query. If the user selects 2 column and enters data as AddItem( string, 0 ), the lists should be self balancing. That is, if six strings were entered, the result is three bulleted items on each side.
Here's the class design--
class RTFTable {
public:
RTFTable();
RTFTable( RTFTable& ) { assert(0);} // don't allow copy
~RTFTable();
enum { AUTO, EXPLICIT };
void SetColumns( int numberColumns ); // 1 or 2 only
void Balancing( int balancing=RTFTable::AUTO );
void AddItem( const char* s, int nColumn=0 ); // 0=auto, 1=col 1, 2=col 2
const char* GetRTFString() { return _strString.c_ptr(); }
private:
string _rtfString;
// other variables such as lists etc. to
// support the class. I prefer template
// containers rather than user implemented
// list structures if possible. The use
// of auto_ptr is also strongly encouraged
// but may not be necessary.
};
</pre>
Here's an example of how I'll use this class--
// create the object that holds the resulting RTF
// table and bulleted list
RTFTable rtf;
rtf.SetColumns( 2 );
rtf.Balancing( AUTO );
// open the database and loop through record sets
while ( more_records )
{
string line = recordset.GetField( "line" );
rtf.AddItem( line.c_ptr() );
}
originalRTFDocument.Replace( "~200", rtf.GetRTFString() );
originalRTFDocument >> outFile;
</pre>
Here's a sample application that does what I want in HTML-- <a href="http://members.home.net/markhenri/byterite/specs/sample.html">click here</a>
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$30 (USD)
|
Jun 17, 2001 9:13:13 PM EDT
|
9.5
(Excellent)
|
|
|
Will provide you code for writing tables. Code is in vc++ project. Pl.contact me for details. |
|
|
|
|
|