Share via


OneNote.Paragraph class

Contenedor para el contenido visible en una página. Un Paragraph puede contener cualquier tipo de ParagraphType de contenido.

Extends

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

Propiedades

context

Contexto de solicitud asociado al objeto . Esto conecta el proceso del complemento al proceso de la aplicación host de Office.

id

Obtiene el identificador del objeto Paragraph. Solo lectura.

image

Obtiene el objeto Image de Paragraph. Produce una excepción si ParagraphType no es Image. Solo lectura.

inkWords

Obtiene la colección Ink de Paragraph. Produce una excepción si ParagraphType no es Ink. Solo lectura.

outline

Obtiene el objeto Outline que contiene Paragraph. Solo lectura.

paragraphs

La colección de párrafos en este párrafo. Solo lectura

parentParagraph

Obtiene el objeto Paragraph principal. Se produce si un párrafo primario no existe. Solo lectura.

parentParagraphOrNull

Obtiene el objeto Paragraph principal. Devuelve NULL si un párrafo principal no existe. Solo lectura.

parentTableCell

Obtiene el objeto TableCell que contiene Paragraph, si existe alguno. Si el principal no es TableCell, produce ItemNotFound. Solo lectura.

parentTableCellOrNull

Obtiene el objeto TableCell que contiene Paragraph, si existe alguno. Si el principal no es TableCell, devuelve NULL. Solo lectura.

richText

Obtiene el objeto RichText de Paragraph. Produce una excepción si ParagraphType no es RichText. Solo lectura

table

Obtiene el objeto Table de Paragraph. Produce una excepción si ParagraphType no es Table. Solo lectura.

type

Obtiene el tipo del objeto Paragraph. Solo lectura.

Métodos

addNoteTag(type, status)

Agregue NoteTag al párrafo.

addNoteTag(typeString, statusString)

Agregue NoteTag al párrafo.

delete()

Elimina el párrafo

getParagraphInfo()

Obtener información de lista del párrafo

insertHtmlAsSibling(insertLocation, html)

Inserta el contenido HTML especificado

insertHtmlAsSibling(insertLocationString, html)

Inserta el contenido HTML especificado

insertImageAsSibling(insertLocation, base64EncodedImage, width, height)

Inserta la imagen en la posición de inserción especificada.

insertImageAsSibling(insertLocationString, base64EncodedImage, width, height)

Inserta la imagen en la posición de inserción especificada.

insertRichTextAsSibling(insertLocation, paragraphText)

Inserta el texto del párrafo en la posición de inserción especificada.

insertRichTextAsSibling(insertLocationString, paragraphText)

Inserta el texto del párrafo en la posición de inserción especificada.

insertTableAsSibling(insertLocation, rowCount, columnCount, values)

Agrega una tabla con el número especificado de filas y columnas antes o después del párrafo actual.

insertTableAsSibling(insertLocationString, rowCount, columnCount, values)

Agrega una tabla con el número especificado de filas y columnas antes o después del párrafo actual.

load(options)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(propertyNames)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(propertyNamesAndPaths)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

set(properties, options)

Establece varias propiedades de un objeto al mismo tiempo. Puede pasar un objeto sin formato con las propiedades adecuadas u otro objeto de API del mismo tipo.

set(properties)

Establece varias propiedades en el objeto al mismo tiempo, en función de un objeto cargado existente.

toJSON()

Invalida el método JavaScript toJSON() para proporcionar una salida más útil cuando se pasa un objeto de API a JSON.stringify(). (JSON.stringifya su vez, llama al toJSON método del objeto que se le pasa). Mientras que el objeto OneNote.Paragraph original es un objeto de API, el toJSON método devuelve un objeto JavaScript sin formato (escrito como OneNote.Interfaces.ParagraphData) que contiene copias superficiales de las propiedades secundarias cargadas del objeto original.

track()

Realiza un seguimiento del objeto de ajuste automático según cambios adyacentes en el documento. Esta llamada es una abreviatura para context.trackedObjects.add(thisObject). Si usa este objeto entre .sync llamadas y fuera de la ejecución secuencial de un lote ".run" y recibe un error "InvalidObjectPath" al establecer una propiedad o invocar un método en el objeto, debe haber agregado el objeto a la colección de objetos de seguimiento cuando se creó el objeto por primera vez.

untrack()

Libere la memoria asociada a este objeto, si se ha realizado un seguimiento de él anteriormente. Esta llamada es abreviada para context.trackedObjects.remove(thisObject). Tener muchos objetos marcados ralentiza la aplicación host, así que debe recordar liberar los objetos que agregue cuando haya terminado con ellos. Tendrá que llamar context.sync() a antes de que la versión de memoria surta efecto.

Detalles de las propiedades

context

Contexto de solicitud asociado al objeto . Esto conecta el proceso del complemento al proceso de la aplicación host de Office.

context: RequestContext;

Valor de propiedad

id

Obtiene el identificador del objeto Paragraph. Solo lectura.

readonly id: string;

Valor de propiedad

string

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

image

Obtiene el objeto Image de Paragraph. Produce una excepción si ParagraphType no es Image. Solo lectura.

readonly image: OneNote.Image;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

inkWords

Obtiene la colección Ink de Paragraph. Produce una excepción si ParagraphType no es Ink. Solo lectura.

readonly inkWords: OneNote.InkWordCollection;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

outline

Obtiene el objeto Outline que contiene Paragraph. Solo lectura.

readonly outline: OneNote.Outline;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

paragraphs

La colección de párrafos en este párrafo. Solo lectura

readonly paragraphs: OneNote.ParagraphCollection;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

parentParagraph

Obtiene el objeto Paragraph principal. Se produce si un párrafo primario no existe. Solo lectura.

readonly parentParagraph: OneNote.Paragraph;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

parentParagraphOrNull

Obtiene el objeto Paragraph principal. Devuelve NULL si un párrafo principal no existe. Solo lectura.

readonly parentParagraphOrNull: OneNote.Paragraph;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

parentTableCell

Obtiene el objeto TableCell que contiene Paragraph, si existe alguno. Si el principal no es TableCell, produce ItemNotFound. Solo lectura.

readonly parentTableCell: OneNote.TableCell;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

parentTableCellOrNull

Obtiene el objeto TableCell que contiene Paragraph, si existe alguno. Si el principal no es TableCell, devuelve NULL. Solo lectura.

readonly parentTableCellOrNull: OneNote.TableCell;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

richText

Obtiene el objeto RichText de Paragraph. Produce una excepción si ParagraphType no es RichText. Solo lectura

readonly richText: OneNote.RichText;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

table

Obtiene el objeto Table de Paragraph. Produce una excepción si ParagraphType no es Table. Solo lectura.

readonly table: OneNote.Table;

Valor de propiedad

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

type

Obtiene el tipo del objeto Paragraph. Solo lectura.

readonly type: OneNote.ParagraphType | "RichText" | "Image" | "Table" | "Ink" | "Other";

Valor de propiedad

OneNote.ParagraphType | "RichText" | "Image" | "Table" | "Ink" | "Other"

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

Detalles del método

addNoteTag(type, status)

Agregue NoteTag al párrafo.

addNoteTag(type: OneNote.NoteTagType, status: OneNote.NoteTagStatus): OneNote.NoteTag;

Parámetros

type
OneNote.NoteTagType

Tipo de notetag.

status
OneNote.NoteTagStatus

Estado de notetag.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

addNoteTag(typeString, statusString)

Agregue NoteTag al párrafo.

addNoteTag(typeString: "Unknown" | "ToDo" | "Important" | "Question" | "Contact" | "Address" | "PhoneNumber" | "Website" | "Idea" | "Critical" | "ToDoPriority1" | "ToDoPriority2", statusString: "Unknown" | "Normal" | "Completed" | "Disabled" | "OutlookTask" | "TaskNotSyncedYet" | "TaskRemoved"): OneNote.NoteTag;

Parámetros

typeString

"Unknown" | "ToDo" | "Important" | "Question" | "Contact" | "Address" | "PhoneNumber" | "Website" | "Idea" | "Critical" | "ToDoPriority1" | "ToDoPriority2"

Tipo de notetag.

statusString

"Unknown" | "Normal" | "Completed" | "Disabled" | "OutlookTask" | "TaskNotSyncedYet" | "TaskRemoved"

Estado de notetag.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

delete()

Elimina el párrafo

delete(): void;

Devoluciones

void

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

Ejemplos

await OneNote.run(async (context) => {

    // Get the collection of pageContent items from the page.
    const pageContents = context.application.getActivePage().contents;

    // Get the first PageContent on the page assuming its an outline, get the outline's paragraphs.
    const pageContent = pageContents.getItemAt(0);
    
    const paragraphs = pageContent.outline.paragraphs;
    
    const firstParagraph = paragraphs.getItemAt(0);
    
    // Queue a command to load the id and type of the first paragraph.
    firstParagraph.load("id,type");

    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();
            
    // Queue a command to delete the first paragraph.
    firstParagraph.delete();
    
    // Run the command to delete it.
    await context.sync();
});

getParagraphInfo()

Obtener información de lista del párrafo

getParagraphInfo(): OfficeExtension.ClientResult<OneNote.ParagraphInfo>;

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

insertHtmlAsSibling(insertLocation, html)

Inserta el contenido HTML especificado

insertHtmlAsSibling(insertLocation: OneNote.InsertLocation, html: string): void;

Parámetros

insertLocation
OneNote.InsertLocation

La ubicación del nuevo contenido relativa a Paragraph actual.

html

string

Una cadena HTML que describe la presentación visual del contenido. Consulte HTML compatible para la API de JavaScript de complementos de OneNote.

Devoluciones

void

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

Ejemplos

await OneNote.run(async (context) => {

    // Get the collection of pageContent items from the page.
    const pageContents = context.application.getActivePage().contents;

    // Get the first PageContent on the page.
    // Assuming its an outline, get the outline's paragraphs.
    const pageContent = pageContents.getItemAt(0);
    const paragraphs = pageContent.outline.paragraphs;
    const firstParagraph = paragraphs.getItemAt(0);

    // Queue a command to load the id and type of the first paragraph.
    firstParagraph.load("id,type");

    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();

    // Queue commands to insert before and after the first paragraph.
    firstParagraph.insertHtmlAsSibling("Before", "<p>ContentBeforeFirstParagraph</p>");
    firstParagraph.insertHtmlAsSibling("After", "<p>ContentAfterFirstParagraph</p>");
    
    // Run the command to run inserts.
    await context.sync();
});

insertHtmlAsSibling(insertLocationString, html)

Inserta el contenido HTML especificado

insertHtmlAsSibling(insertLocationString: "Before" | "After", html: string): void;

Parámetros

insertLocationString

"Before" | "After"

La ubicación del nuevo contenido relativa a Paragraph actual.

html

string

Una cadena HTML que describe la presentación visual del contenido. Consulte HTML compatible para la API de JavaScript de complementos de OneNote.

Devoluciones

void

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

insertImageAsSibling(insertLocation, base64EncodedImage, width, height)

Inserta la imagen en la posición de inserción especificada.

insertImageAsSibling(insertLocation: OneNote.InsertLocation, base64EncodedImage: string, width: number, height: number): OneNote.Image;

Parámetros

insertLocation
OneNote.InsertLocation

La ubicación de la tabla relativa a Paragraph actual.

base64EncodedImage

string

Cadena HTML que se anexará.

width

number

Opcional. Ancho en la unidad de puntos. El valor predeterminado es null, que respeta el ancho de la imagen.

height

number

Opcional. Alto en la unidad de puntos. El valor predeterminado es null, que respeta el alto de la imagen.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

Ejemplos

await OneNote.run(async (context) => {

    // Get the collection of pageContent items from the page.
    const pageContents = context.application.getActivePage().contents;

    // Get the first PageContent on the page.
    // Assuming its an outline, get the outline's paragraphs.
    const pageContent = pageContents.getItemAt(0);
    const paragraphs = pageContent.outline.paragraphs;
    const firstParagraph = paragraphs.getItemAt(0);

    // Queue a command to load the id and type of the first paragraph.
    firstParagraph.load("id,type");

    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();

    // Queue commands to insert before and after the first paragraph.
    firstParagraph.insertImageAsSibling("Before", "R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw==");
    firstParagraph.insertImageAsSibling("After", "R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw==");
    
    // Run the command to insert images.
    await context.sync();
});

insertImageAsSibling(insertLocationString, base64EncodedImage, width, height)

Inserta la imagen en la posición de inserción especificada.

insertImageAsSibling(insertLocationString: "Before" | "After", base64EncodedImage: string, width: number, height: number): OneNote.Image;

Parámetros

insertLocationString

"Before" | "After"

La ubicación de la tabla relativa a Paragraph actual.

base64EncodedImage

string

Cadena HTML que se anexará.

width

number

Opcional. Ancho en la unidad de puntos. El valor predeterminado es null, que respeta el ancho de la imagen.

height

number

Opcional. Alto en la unidad de puntos. El valor predeterminado es null, que respeta el alto de la imagen.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

insertRichTextAsSibling(insertLocation, paragraphText)

Inserta el texto del párrafo en la posición de inserción especificada.

insertRichTextAsSibling(insertLocation: OneNote.InsertLocation, paragraphText: string): OneNote.RichText;

Parámetros

insertLocation
OneNote.InsertLocation

La ubicación de la tabla relativa a Paragraph actual.

paragraphText

string

Cadena HTML que se anexará.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

Ejemplos

await OneNote.run(async (context) => {

    // Get the collection of pageContent items from the page.
    const pageContents = context.application.getActivePage().contents;

    // Get the first PageContent on the page assuming its an outline, get the outline's paragraphs.
    const pageContent = pageContents.getItemAt(0);
    const paragraphs = pageContent.outline.paragraphs;
    const firstParagraph = paragraphs.getItemAt(0);

    // Queue a command to load the id and type of the first paragraph.
    firstParagraph.load("id,type");

    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();

    // Queue commands to insert before and after the first paragraph.
    firstParagraph.insertRichTextAsSibling("Before", "Text Appears Before Paragraph");
    firstParagraph.insertRichTextAsSibling("After", "Text Appears After Paragraph");
    
    // Run the command to insert text contents.
    await context.sync();
});

insertRichTextAsSibling(insertLocationString, paragraphText)

Inserta el texto del párrafo en la posición de inserción especificada.

insertRichTextAsSibling(insertLocationString: "Before" | "After", paragraphText: string): OneNote.RichText;

Parámetros

insertLocationString

"Before" | "After"

La ubicación de la tabla relativa a Paragraph actual.

paragraphText

string

Cadena HTML que se anexará.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

insertTableAsSibling(insertLocation, rowCount, columnCount, values)

Agrega una tabla con el número especificado de filas y columnas antes o después del párrafo actual.

insertTableAsSibling(insertLocation: OneNote.InsertLocation, rowCount: number, columnCount: number, values?: string[][]): OneNote.Table;

Parámetros

insertLocation
OneNote.InsertLocation

La ubicación de la tabla relativa a Paragraph actual.

rowCount

number

Número de filas de la tabla.

columnCount

number

Número de columnas de la tabla.

values

string[][]

Matriz 2D opcional. Si se especifican las cadenas correspondientes en la matriz, se rellenan las celdas.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

insertTableAsSibling(insertLocationString, rowCount, columnCount, values)

Agrega una tabla con el número especificado de filas y columnas antes o después del párrafo actual.

insertTableAsSibling(insertLocationString: "Before" | "After", rowCount: number, columnCount: number, values?: string[][]): OneNote.Table;

Parámetros

insertLocationString

"Before" | "After"

La ubicación de la tabla relativa a Paragraph actual.

rowCount

number

Número de filas de la tabla.

columnCount

number

Número de columnas de la tabla.

values

string[][]

Matriz 2D opcional. Si se especifican las cadenas correspondientes en la matriz, se rellenan las celdas.

Devoluciones

Comentarios

[ Conjunto de API: OneNoteApi 1.1 ]

load(options)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(options?: OneNote.Interfaces.ParagraphLoadOptions): OneNote.Paragraph;

Parámetros

options
OneNote.Interfaces.ParagraphLoadOptions

Proporciona opciones para las propiedades del objeto que se van a cargar.

Devoluciones

load(propertyNames)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(propertyNames?: string | string[]): OneNote.Paragraph;

Parámetros

propertyNames

string | string[]

Una cadena delimitada por comas o una matriz de cadenas que especifican las propiedades que se van a cargar.

Devoluciones

Ejemplos

await OneNote.run(async (context) => {

    // Get the collection of pageContent items from the page.
    const pageContents = context.application.getActivePage().contents;
    
    // Queue a command to load the outline property of each pageContent.
    pageContents.load("outline");
        
    // Get the first PageContent on the page, and then get its Outline.
    const pageContent = pageContents._GetItem(0);
    const paragraphs = pageContent.outline.paragraphs;
            
    // Queue a command to load the id and type of each paragraph.
    paragraphs.load("id,type");
            
    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();
    // Write the text.
    $.each(paragraphs.items, function(index, paragraph) {
        console.log("Paragraph type: " + paragraph.type);
        console.log("Paragraph ID: " + paragraph.id);
    });
});

load(propertyNamesAndPaths)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): OneNote.Paragraph;

Parámetros

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select es una cadena delimitada por comas que especifica las propiedades que se van a cargar y propertyNamesAndPaths.expand es una cadena delimitada por comas que especifica las propiedades de navegación que se van a cargar.

Devoluciones

set(properties, options)

Establece varias propiedades de un objeto al mismo tiempo. Puede pasar un objeto sin formato con las propiedades adecuadas u otro objeto de API del mismo tipo.

set(properties: Interfaces.ParagraphUpdateData, options?: OfficeExtension.UpdateOptions): void;

Parámetros

properties
OneNote.Interfaces.ParagraphUpdateData

Objeto JavaScript con propiedades estructuradas isomórficamente con las propiedades del objeto al que se llama al método.

options
OfficeExtension.UpdateOptions

Proporciona una opción para suprimir errores si el objeto properties intenta establecer propiedades de solo lectura.

Devoluciones

void

set(properties)

Establece varias propiedades en el objeto al mismo tiempo, en función de un objeto cargado existente.

set(properties: OneNote.Paragraph): void;

Parámetros

properties
OneNote.Paragraph

Devoluciones

void

toJSON()

Invalida el método JavaScript toJSON() para proporcionar una salida más útil cuando se pasa un objeto de API a JSON.stringify(). (JSON.stringifya su vez, llama al toJSON método del objeto que se le pasa). Mientras que el objeto OneNote.Paragraph original es un objeto de API, el toJSON método devuelve un objeto JavaScript sin formato (escrito como OneNote.Interfaces.ParagraphData) que contiene copias superficiales de las propiedades secundarias cargadas del objeto original.

toJSON(): OneNote.Interfaces.ParagraphData;

Devoluciones

track()

Realiza un seguimiento del objeto de ajuste automático según cambios adyacentes en el documento. Esta llamada es una abreviatura para context.trackedObjects.add(thisObject). Si usa este objeto entre .sync llamadas y fuera de la ejecución secuencial de un lote ".run" y recibe un error "InvalidObjectPath" al establecer una propiedad o invocar un método en el objeto, debe haber agregado el objeto a la colección de objetos de seguimiento cuando se creó el objeto por primera vez.

track(): OneNote.Paragraph;

Devoluciones

untrack()

Libere la memoria asociada a este objeto, si se ha realizado un seguimiento de él anteriormente. Esta llamada es abreviada para context.trackedObjects.remove(thisObject). Tener muchos objetos marcados ralentiza la aplicación host, así que debe recordar liberar los objetos que agregue cuando haya terminado con ellos. Tendrá que llamar context.sync() a antes de que la versión de memoria surta efecto.

untrack(): OneNote.Paragraph;

Devoluciones