# Saves text with text indentation for readability. How to remove?

**URL:** <https://forum.kirupa.com/t/saves-text-with-text-indentation-for-readability-how-to-remove/329979>\
**Category:** flash\
**Created:** [November 13, 2012, 8:54pm UTC](https://forum.kirupa.com/t/saves-text-with-text-indentation-for-readability-how-to-remove/329979 "2012-11-13T20:54:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lnsiu](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@lnsiu](https://forum.kirupa.com/u/lnsiu)\
**Post date:** [November 13, 2012, 8:54pm UTC](https://forum.kirupa.com/t/saves-text-with-text-indentation-for-readability-how-to-remove/329979/1 "2012-11-13T20:54:37Z")

</div>

Hi, I have a problem with at text that is saved to a file.  
By default, flash seems to add automatic indentation, while the picked text does not seem to have this indentation.

Come to think of it, perhaps it is because it is xml that I save to txt?

hmmm…

```auto
[COLOR=#3DA779][FONT=Monaco]function[/FONT][/COLOR][FONT=Monaco] exportTextLayerTxts(fileDest:String):[/FONT][COLOR=#0052FF][FONT=Monaco]void[/FONT][/COLOR][FONT=Monaco]{[/FONT]
[FONT=Monaco]	[COLOR=#78aad6]var[/COLOR] file_dest:String = removeFilenameFromPath(fileDest);[/FONT]
[FONT=Monaco]	[COLOR=#0052ff]for[/COLOR] ([COLOR=#78aad6]var[/COLOR] i:int = 0; i < textforsaveArr.length; i++) [/FONT]
[FONT=Monaco]	{[/FONT]
[COLOR=#AB1500][FONT=Monaco][COLOR=#000000] tracew([/COLOR]"exporting file"[COLOR=#000000]);[/COLOR][/FONT][/COLOR]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] fileName:String = textforsaveArr*[0];[/FONT]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] xmlNode:XMLList = textforsaveArr*[1];[/FONT]
[FONT=Monaco] [/FONT]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] xmlString:String = xmlNode.toXMLString();[/FONT]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] newXMLfromString:XML = [COLOR=#0052ff]new[/COLOR] XML(xmlString); [/FONT]
[FONT=Monaco] [/FONT]
[FONT=Monaco] [/FONT]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] fileDestPath:String = file_dest + fileName;[/FONT]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] file:File = [COLOR=#0052ff]new[/COLOR] File(fileDestPath);[/FONT]
[FONT=Monaco] file = file.resolvePath(fileDestPath);[/FONT]
[FONT=Monaco] [/FONT]
[FONT=Monaco] [COLOR=#78aad6]var[/COLOR] stream:FileStream = [COLOR=#0052ff]new[/COLOR] FileStream();[/FONT]
[FONT=Monaco] stream.open(file, FileMode.WRITE);[/FONT]
[FONT=Monaco] stream.writeUTFBytes(newXMLfromString);[/FONT]
[FONT=Monaco] stream.addEventListener(Event.CLOSE, fileClosed); [/FONT]
[FONT=Monaco] stream.close();[/FONT]
[FONT=Monaco] [/FONT]
[FONT=Monaco] [COLOR=#3da779]function[/COLOR] fileClosed(event:Event):[COLOR=#0052ff]void[/COLOR] { [/FONT]
[COLOR=#AB1500][FONT=Monaco][COLOR=#000000] tracew([/COLOR]"closed event fired"[COLOR=#000000]); [/COLOR][/FONT][/COLOR]
[FONT=Monaco] } [/FONT]
[FONT=Monaco]	}[/FONT]
[FONT=Monaco]}[/FONT]

```
