<h1class="memberHeader"><spanclass="name">Document<spanclass="editInC9"><ahref='http://c9.io/open/git/?url=git%3A%2F%2Fgithub.com%2Fajaxorg%2Face.git'title='Edit in Cloud9 IDE'>[edit]</a></span></span>
<divclass="memberContent"><p>Contains the text of the document. Documents are controlled by a single <ahref="edit_session.html#EditSession"class="link-short"title="EditSession (class)"data-id="EditSession"><code>EditSession</code></a>. At its core, <code>Document</code>s are just an array of strings, with each row in the document matching up to the array index.</p>
<divid="ellipsis_new Document"class="ellipsis_description"><p>Creates a new <code>Document</code>. If <code>text</code> is included, the <code>Document</code> contains those strings; otherwise, it's empty. ...</p>
</div>
<divid="short_new Document"class="short_description hiddenSpan"><p>Creates a new <code>Document</code>. If <code>text</code> is included, the <code>Document</code> contains those strings; otherwise, it's empty.</p>
<divid="ellipsis_Document.applyDeltas"class="ellipsis_description"><p>Applies all the changes previously accumulated. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>...</p>
</div>
<divid="short_Document.applyDeltas"class="short_description hiddenSpan"><p>Applies all the changes previously accumulated. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and <code>'removeLines'</code>.</p>
<divid="ellipsis_Document.createAnchor"class="ellipsis_description"><p>Creates a new <code>Anchor</code> to define a floating point in the document. ...</p>
</div>
<divid="short_Document.createAnchor"class="short_description hiddenSpan"><p>Creates a new <code>Anchor</code> to define a floating point in the document.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The row number to use</td></tr><trclass="argumentRow "><tdclass="argName ">column</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The column number to use</td></tr></table>
<divid="ellipsis_Document.getAllLines"class="ellipsis_description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array! ...</p>
</div>
<divid="short_Document.getAllLines"class="short_description hiddenSpan"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The row index to retrieve</td></tr></table>
<divid="ellipsis_Document.getLines"class="ellipsis_description"><p>Returns an array of strings of the rows between <code>firstRow</code> and <code>lastRow</code>. This function is inclusive of <code>lastRow</code>. ...</p>
</div>
<divid="short_Document.getLines"class="short_description hiddenSpan"><p>Returns an array of strings of the rows between <code>firstRow</code> and <code>lastRow</code>. This function is inclusive of <code>lastRow</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">firstRow</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The first row index to retrieve</td></tr><trclass="argumentRow "><tdclass="argName ">lastRow</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The final row index to retrieve</td></tr></table>
<divid="ellipsis_Document.getNewLineCharacter"class="ellipsis_description"><p>Returns the newline character that's being used, depending on the value of <code>newLineMode</code>. ...</p>
</div>
<divid="short_Document.getNewLineCharacter"class="short_description hiddenSpan"><p>Returns the newline character that's being used, depending on the value of <code>newLineMode</code>.</p>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="returnDescription ">If <code>newLineMode == windows</code>, <code>\r\n</code> is returned.<br/> If <code>newLineMode == unix</code>, <code>\n</code> is returned.<br/> If <code>newLineMode == auto</code>, the value of <code>autoNewLine</code> is returned.</td></tr></table>
<divid="ellipsis_Document.getNewLineMode"class="ellipsis_description"><p>Returns the type of newlines being used; either <code>windows</code>, <code>unix</code>, or <code>auto</code></p>
</div>
<divid="short_Document.getNewLineMode"class="short_description hiddenSpan"><p>Returns the type of newlines being used; either <code>windows</code>, <code>unix</code>, or <code>auto</code></p>
<divid="ellipsis_Document.getTextRange"class="ellipsis_description"><p>[Given a range within the document, this function returns all the text within that range as a single string.]{: #Doc...</p>
</div>
<divid="short_Document.getTextRange"class="short_description hiddenSpan"><p>Given a range within the document, this function returns all the text within that range as a single string.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html#Range"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription ">Required. The range to work with</td></tr></table>
<divid="ellipsis_Document.getValue"class="ellipsis_description"><p>Returns all the lines in the document as a single string, split by the new line character. ...</p>
</div>
<divid="short_Document.getValue"class="short_description hiddenSpan"><p>Returns all the lines in the document as a single string, split by the new line character.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">position</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The position to start inserting at</td></tr><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. A chunk of text to insert</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="returnDescription ">The position of the last line of <code>text</code>. If the length of <code>text</code> is 0, this function simply returns <code>position</code>. Inserts a block of <code>text</code> and the indicated <code>position</code>.</td></tr></table>
<divid="ellipsis_Document.insertInLine"class="ellipsis_description"><p>Inserts <code>text</code> into the <code>position</code> at the current row. This method also triggers the <code>'change'</code> event. ...</p>
</div>
<divid="short_Document.insertInLine"class="short_description hiddenSpan"><p>Inserts <code>text</code> into the <code>position</code> at the current row. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">position</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The position to insert at</td></tr><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. A chunk of text</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Object.html"class=""title="Object"data-id="Object">Object</a></td><tdclass="returnDescription ">Returns an object containing the final row and column, like this:<br/><code>{row: endRow, column: 0}</code></td></tr><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="returnDescription ">If <code>text</code> is empty, this function returns the value of <code>position</code></td></tr></table>
<divid="ellipsis_Document.insertLines"class="ellipsis_description"><p>Inserts the elements in <code>lines</code> into the document, starting at the row index given by <code>row</code>. This method also trigge...</p>
</div>
<divid="short_Document.insertLines"class="short_description hiddenSpan"><p>Inserts the elements in <code>lines</code> into the document, starting at the row index given by <code>row</code>. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The index of the row to insert at</td></tr><trclass="argumentRow "><tdclass="argName ">lines</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Array.html"class=""title="Array"data-id="Array">Array</a></td><tdclass="argDescription ">Required. An array of strings</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Object.html"class=""title="Object"data-id="Object">Object</a></td><tdclass="returnDescription ">Returns an object containing the final row and column, like this:<br/><code>{row: endRow, column: 0}</code><br/> If <code>lines</code> is empty, this function returns an object containing the current row, and column, like this:<br/><code>{row: row, column: 0}</code></td></tr></table>
<divid="ellipsis_Document.insertNewLine"class="ellipsis_description"><p>Inserts a new line into the document at the current row's <code>position</code>. This method also triggers the <code>'change'</code> event. ...</p>
</div>
<divid="short_Document.insertNewLine"class="short_description hiddenSpan"><p>Inserts a new line into the document at the current row's <code>position</code>. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">position</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. The position to insert at</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Object.html"class=""title="Object"data-id="Object">Object</a></td><tdclass="returnDescription ">Returns an object containing the final row and column, like this:<br/><code>{row: endRow, column: 0}</code></td></tr></table>
<divid="ellipsis_Document.isNewLine"class="ellipsis_description"><p>Returns <code>true</code> if <code>text</code> is a newline character (either <code>\r\n</code>, <code>\r</code>, or <code>\n</code>). ...</p>
</div>
<divid="short_Document.isNewLine"class="short_description hiddenSpan"><p>Returns <code>true</code> if <code>text</code> is a newline character (either <code>\r\n</code>, <code>\r</code>, or <code>\n</code>).</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. The text to check</td></tr></table>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html#Range"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription ">Required. A specified Range to remove</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Object.html"class=""title="Object"data-id="Object">Object</a></td><tdclass="returnDescription ">Returns the new <code>start</code> property of the range, which contains <code>startRow</code> and <code>startColumn</code>. If <code>range</code> is empty, this function returns the unmodified value of <code>range.start</code>.</td></tr></table>
<divid="ellipsis_Document.removeInLine"class="ellipsis_description"><p>Removes the specified columns from the <code>row</code>. This method also triggers the <code>'change'</code> event. ...</p>
</div>
<divid="short_Document.removeInLine"class="short_description hiddenSpan"><p>Removes the specified columns from the <code>row</code>. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">row</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The row to remove from</td></tr><trclass="argumentRow "><tdclass="argName ">startColumn</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The column to start removing at</td></tr><trclass="argumentRow "><tdclass="argName ">endColumn</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The column to stop removing at</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Object.html"class=""title="Object"data-id="Object">Object</a></td><tdclass="returnDescription ">Returns an object containing <code>startRow</code> and <code>startColumn</code>, indicating the new row and column values.<br/>If <code>startColumn</code> is equal to <code>endColumn</code>, this function returns nothing.</td></tr></table>
<divid="ellipsis_Document.removeLines"class="ellipsis_description"><p>Removes a range of full lines. This method also triggers the <code>'change'</code> event. ...</p>
</div>
<divid="short_Document.removeLines"class="short_description hiddenSpan"><p>Removes a range of full lines. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">firstRow</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The first row to be removed</td></tr><trclass="argumentRow "><tdclass="argName ">lastRow</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/Number.html"class=""title="Number"data-id="Number">Number</a></td><tdclass="argDescription ">Required. The last row to be removed</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Array.html"class=""title="Array"data-id="Array">Array</a> of <ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a>s</td><tdclass="returnDescription ">Returns all the removed lines.</td></tr></table>
<divid="ellipsis_Document.removeNewLine"class="ellipsis_description"><p>Removes the new line between <code>row</code> and the row immediately following it. This method also triggers the <code>'change'</code> event. ...</p>
</div>
<divid="short_Document.removeNewLine"class="short_description hiddenSpan"><p>Removes the new line between <code>row</code> and the row immediately following it. This method also triggers the <code>'change'</code> event.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">range</td><tdclass="argType""><ahref="range.html#Range"class=""title="Range (class)"data-id="Range">Range</a></td><tdclass="argDescription ">Required. A specified Range to replace</td></tr><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. The new text to use as a replacement</td></tr></table>
<h4>Returns</h4><tableclass="returnTable return-list table table-striped table-bordered"><trclass=" "><tdclass="returnType "><ahref="http://www.nodemanual.org/latest/js_doc/Object.html"class=""title="Object"data-id="Object">Object</a></td><tdclass="returnDescription ">Returns an object containing the final row and column, like this: {row: endRow, column: 0} If the text and range are empty, this function returns an object containing the current <code>range.start</code> value. If the text is the exact same as what currently exists, this function returns an object containing the current <code>range.end</code> value.</td></tr></table>
<divid="ellipsis_Document.revertDeltas"class="ellipsis_description"><p>Reverts any changes previously applied. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and `'...</p>
</div>
<divid="short_Document.revertDeltas"class="short_description hiddenSpan"><p>Reverts any changes previously applied. These can be either <code>'includeText'</code>, <code>'insertLines'</code>, <code>'removeText'</code>, and <code>'removeLines'</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">newLineMode</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. The newline mode to use; can be either <code>windows</code>, <code>unix</code>, or <code>auto</code></td></tr></table>
<divid="ellipsis_Document.setValue"class="ellipsis_description"><p>Replaces all the lines in the current <code>Document</code> with the value of <code>text</code>. ...</p>
</div>
<divid="short_Document.setValue"class="short_description hiddenSpan"><p>Replaces all the lines in the current <code>Document</code> with the value of <code>text</code>.</p>
<h4>Arguments</h4><tableclass="argumentTable argument-list table table-striped table-bordered"><trclass="argumentRow "><tdclass="argName ">text</td><tdclass="argType""><ahref="http://www.nodemanual.org/latest/js_doc/String.html"class=""title="String"data-id="String">String</a></td><tdclass="argDescription ">Required. The text to use</td></tr></table>