This project has been created with @adobe/create-ccweb-add-on. As an example, this Add-on demonstrates how to get started with Add-on development using React and TypeScript with Document Sandbox Runtime.
This project is an Adobe Express Add-on that allows users to create and manipulate tables within Adobe Express documents. It leverages the Document Sandbox Runtime to provide a seamless integration with Adobe Express, enabling advanced table creation and customization features.
- HTML
- CSS
- React
- TypeScript
- Adobe Express Document Sandbox SDK
-
Clone the repository:
git clone https://github.com/your-username/tables-for-express.git cd tables-for-express -
Install the dependencies:
npm install
-
Build the application:
npm run build
-
Start the application:
npm run start
Once the application is running, you can access it in Adobe Express. The Add-on provides a user interface for creating and customizing tables. You can specify the number of rows and columns, import data from CSV files, and apply various styles to the table.
- Open the Add-on in Adobe Express.
- Use the "Data" tab to specify the number of rows and columns or import data from a CSV file.
- Use the "Design" tab to select a style for the table.
- Use the "Options" tab to customize text alignment and other settings.
- Click the "Create" button to generate the table in the document.
The DocumentSandboxApi interface declares all the APIs that the document sandbox runtime exposes to the UI/iframe runtime. Below are the detailed descriptions of each API method.
Creates a rectangle with specified dimensions, color, position, and text content.
createRectangle({width, height, color, textColor, x, y, textContent, textAlignment, strokeColor, strokeWidth}): GroupNode | null;-
Parameters:
width: The width of the rectangle.height: The height of the rectangle.color: The fill color of the rectangle.textColor: The color of the text inside the rectangle.x: The x-coordinate of the rectangle's position.y: The y-coordinate of the rectangle's position.textContent: The text content inside the rectangle.textAlignment: The alignment of the text within the rectangle.strokeColor: The color of the rectangle's border.strokeWidth: The width of the rectangle's border.
-
Returns: A group node containing the rectangle and text, or null if creation fails.
-
Throws: When invalid dimensions are provided.
Creates a table with specified columns, rows, and styling.
createTable({ columns, rows, gutter, selectedStyle, columnValues, rowData, textAlignment}): void;-
Parameters:
columns: Number of columns in the table.rows: Number of rows in the table.gutter: Space between cells.selectedStyle: Style configuration object containing colors for header, row, and stroke.columnValues: Object containing column headers text values.rowData: Array of objects containing data for each row.textAlignment: Text alignment within cells.
-
Throws: If columns or rows are less than or equal to 0, if table dimensions result in invalid height, or if column or row creation fails.
Creates a row of cells in a table layout.
createRow({rowIndex, columns, columnWidth, rowHeight, gutter, color, selectedStyle, rowValues, textAlignment, strokeColor, strokeWidth }): GroupNode | null;-
Parameters:
rowIndex: The index of the row (0-based).columns: The number of columns in the row.columnWidth: The width of each column.rowHeight: The height of the row.gutter: The spacing between cells and rows.color: The default color for cells in this row.rowValues: Array of text values for each cell in the row.selectedStyle: Style configuration object containing colors property.textAlignment: The alignment of text within cells.strokeColor: The color of the cell borders.strokeWidth: The width of the cell borders.
-
Returns: A group node containing the row's cells, or null if creation fails.
-
Throws: When invalid dimensions or column count are provided, or when cell creation fails.
Creates a column with specified dimensions, color, and text content.
createColumn ({columnIndex, columnWidth, rowHeight, gutter, color, textColor, textContent, textAlignment, strokeColor, strokeWidth}): GroupNode | null;-
Parameters:
columnIndex: The index of the column (0-based).columnWidth: The width of the column.rowHeight: The height of the column's header row.gutter: The spacing between columns.color: The fill color of the column's header row.textColor: The color of the text inside the column's header row.textContent: The text content inside the column's header row.textAlignment: The alignment of the text within the column's header row.strokeColor: The color of the column's border.strokeWidth: The width of the column's border.
-
Returns: A group node containing the column's header row, or null if creation fails.
-
Throws: When invalid dimensions are provided.
Wraps text to fit within a specified width.
wrapText({textContent, width, textWidth}) : string;-
Parameters:
textContent: The text content to wrap.width: The maximum width for the wrapped text.textWidth: The width of the text content.
-
Returns: The wrapped text.
Calculates the width of a given text string.
calculateTextWidth(text): number;-
Parameters:
text: The text string to measure.
-
Returns: The width of the text string.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them with a descriptive message.
- Push your changes to your fork.
- Create a pull request to the main repository.
This project is licensed under the MIT License. See the LICENSE file for details.