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
 workbook comments
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Scomex

France
5 Posts

Posted - 03/04/2013 :  11:19:22 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 8.0.63.988 SR6 (8.0988)
Operating System: Windows 7

Hi,
My aim is to import several txt files into a work book and then set the path and name of these files as comments into this workbook.

wksPg.Create();
wks0=wksPg.Layers(0);
char str_comments[10000];
ASCIMP ai1, ai2;
int nbfiles;
StringArray icspath;
nbfiles = GetMultiOpenBox(icspath, "*.txt");
if(nbfiles>0)
{
printf("%d files :\n",nbfiles);
for(index =0; index<nbfiles; index++)
{
if(AscImpReadFileStruct(icspath[index], &ai1)==0)
{
strcat(str_comments, icspath[index]+"\n");
ai1.iMode = ASCIMP_MODE_APPEND_COLS;
ai1.iRenameCols = 0;
wks0.ImportASCII(icspath[index], ai1);
wks0.AutoSize();
}
wksPg.SetComments(str_comments);
}
}
else
{
printf("no file !");
}

The problem is that even if I write "\n" in the string concatenation, the final comment is on a single line. For easier reading, I would rather have a new line for each string containing the filename.
Another thing is that the workbook and the worksheet get the name of the final imported file and I don't know how to keep a constant worksheet name.

Edited by - Scomex on 03/04/2013 12:24:27 PM

Penn

China
644 Posts

Posted - 03/04/2013 :  9:09:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

1. Please use "\r\n" instead to display as a new line.

2. See ASCIMP structure, need to set iRenameWks to 1, such as

ai1.iRenameWks = 0;


Penn
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