The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Placing strings in worksheet columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

beenyy

USA
Posts

Posted - 04/08/2004 :  8:04:59 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm trying to place strings in to columns of a worksheet. Currently I'm using something like this:

Dataset number_data(wks, 0);
number_data.SetSize(length);
number_data[0] = 5;

string str;
str = "some string";
Dataset string_data(wks, 1);
string_data.SetSize(length);
string_data[0] = str;

The above works fine when the data is a number, but when it's a string I get the error: Error, Incompatible variable types in expression. How do I get the string data into my worksheet columns?

Thanks,
beenyy

Iris_Bai

China
Posts

Posted - 04/08/2004 :  10:51:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi beenyy,


// Worksheet column Data1_B must exist prior to execution.
void ttgp()
{
Column col("Data1", 1);
if(!col)
return;
//Must make sure the format of the column should be Text type
if( OKCOLTYPE_TEXT_NUMERIC != col.GetFormat() || OKCOLTYPE_TEXT != col.GetFormat())
col.SetFormat(OKCOLTYPE_TEXT_NUMERIC);

string str;
Dataset dsB("Data1_B");

dsB.SetSize(2);
for(int ii=0; ii<dsB.GetSize(); ii++)
{
str.Format("Row %d", ii);
dsB.SetText(ii, str);
}

}


Iris
Go to Top of Page

beenyy

USA
Posts

Posted - 04/09/2004 :  2:50:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Iris!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000