Waspman
Posts: 948
|
| Posted: 11/16/2008, 7:40 AM |
|
I'm writting outputted data to a text file by simple adding
Header("Content-type: application/vnd.text/plain");
Header("Content-Disposition: inline; filename=\"TEXT.w01\"");
in the before show event.
I've removed all HTML tags etc, but I want each record to break at the end of the line i.e. 0D0A
and not be visible when the text file is opened.
Any ideas?
_________________
http://www.waspmedia.co.uk |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/16/2008, 11:30 AM |
|
Hi
Try printing the newline character to the file
'\n'
where ever you want a line break
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
Waspman
Posts: 948
|
| Posted: 11/17/2008, 5:07 AM |
|
Thanks John, but already tried that,
It just prints '\n' in the string.
Probably where I put it was the problem.
This is a grid output based on specified criteria. I put the '\n' after each of the field references.
{field1}'\n'{field2}'\n' etc.
Is this correct?
Thanks again for coming back to me...T
_________________
http://www.waspmedia.co.uk |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/17/2008, 6:02 AM |
|
No... Not in the HTML.
Put it into the field during the before show row event for that field.
Try in the before show row event something like this.
$Container->fieldname->SetValue($Container->fieldname->GetValue()."\n");
BTW how are you outputting this to a file? I would be curious.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 11/17/2008, 6:06 AM |
|
Here is another possible way now that I think of it.
in your HTML put this {nl} where you whant a new line.
eg: {field1]{nl}{field2}
Somewhere in your code like before show page or something put this custom code.
global $Tpl;
$Tpl->setval("nl","\n");
Have fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
Waspman
Posts: 948
|
| Posted: 11/20/2008, 4:01 AM |
|
Hi John,
Anything that adds something to the string will be rendered as is.
It's got to occur in the php file itself I've got "\x0D" to work, but can't add "\x0A" it keeps converting to <br />. I tried "\x0D-\x0A" but no joy yet.
Tony
_________________
http://www.waspmedia.co.uk |
 |
 |
Waspman
Posts: 948
|
| Posted: 11/20/2008, 4:39 AM |
|
Cracked it!
In the php code I added "\x0D"."\x0A" after the setValue
...and removed the replace "\n" with $BRValue from the classes.php (this might cause a problem, but not found anything yet)
Works great!
T
_________________
http://www.waspmedia.co.uk |
 |
 |
Waspman
Posts: 948
|
| Posted: 11/20/2008, 4:56 AM |
|
Better still, you can add the \x0D and \x0A in the before show event of the label so empty records don't show as returns..T
_________________
http://www.waspmedia.co.uk |
 |
 |
antman48
Posts: 7
|
| Posted: 12/11/2008, 11:45 AM |
|
All strings are not the same. new line is only
"n"
not
'n'
|
 |
 |