Shape
aspose-cells-foss supporta l’aggiunta di forme geometriche e caselle di testo ai fogli di lavoro tramite il ShapeCollection (ws.shapes). Ogni forma è rappresentata da un Shape oggetto con proprietà configurabili di riempimento, linea e testo.
ColladaSaveOptions: aspose.cells_foss
from aspose.cells_foss import (
MsoDrawingType, FillType, MsoLineDashStyle,
TextAlignmentType, TextAnchorType,
MsoFillFormat, MsoLineFormat, ShapeFont, Shape,
)MsoDrawingType
MsoDrawingType è un IntEnum che identifica il tipo di forma geometrica.
| Name | Type | Access | Description |
|---|---|---|---|
upper_left_row | `` | Read/Write | Gets or sets the upper left row. |
upper_left_column | `` | Read/Write | Gets or sets the upper left column. |
lower_right_row | `` | Read/Write | Gets or sets the lower right row. |
lower_right_column | `` | Read/Write | Gets or sets the lower right column. |
upper_left_row_offset | `` | Read/Write | Gets or sets the upper left row offset. |
upper_left_column_offset | `` | Read/Write | Gets or sets the upper left column offset. |
lower_right_row_offset | `` | Read/Write | Gets or sets the lower right row offset. |
lower_right_column_offset | `` | Read/Write | Gets or sets the lower right column offset. |
name | `` | Read | Gets the name. |
drawing_type | `` | Read | Gets the drawing type. |
fill | `` | Read | Gets the fill. |
line | `` | Read | Gets the line. |
text | `` | Read | Gets the text. |
font | `` | Read | Gets the font. |
text_horizontal_alignment | `` | Read | Gets the text horizontal alignment. |
text_vertical_alignment | `` | Read | Gets the text vertical alignment. |
is_text_wrapped | `` | Read | Gets the is text wrapped. |
is_locked | `` | Read | Gets the is locked. |
is_hidden | `` | Read | Gets the is hidden. |
placement | `` | Read | Gets the placement. |
hyperlink | `` | Read | Gets the hyperlink. |
FillType
FillType è un IntEnum che identifica il tipo di riempimento applicato a una forma.
| Signature | Description |
|---|---|
__init__(drawing_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column) | |
copy() | Creates a duplicate of the shape object |
MsoLineDashStyle
MsoLineDashStyle è un IntEnum per il modello di tratteggio della linea di bordo/contorno.
TextAlignmentType
TextAlignmentType è un IntEnum per l’allineamento orizzontale del testo all’interno di una forma.
TextAnchorType
TextAnchorType è un IntEnum per l’ancoraggio verticale del testo all’interno di una forma.
MsoFillFormat
Controlla l’aspetto del riempimento di una forma. Accessibile tramite shape.fill.
ColladaSaveOptions
ColladaSaveOptions
copia
fill.copy() -> MsoFillFormatRestituisce una copia profonda di queste impostazioni di riempimento.
MsoLineFormat
Controlla l’aspetto del contorno/bordo di una forma. Accessibile tramite shape.line.
ColladaSaveOptions
ColladaSaveOptions
copia
line.copy() -> MsoLineFormatRestituisce una copia profonda di queste impostazioni di linea.
ShapeFont
Controlla il carattere del testo all’interno di una forma. Accessibile tramite shape.font.
ColladaSaveOptions
ColladaSaveOptions
copia
font.copy() -> ShapeFontRestituisce una copia profonda di queste impostazioni del font.
ColladaSaveOptions
Shape gli oggetti non sono costruiti direttamente. Usa ws.shapes.add(...) o ws.shapes.add_text_box(...).
ColladaSaveOptions
ColladaSaveOptions
copia
shape.copy() -> ShapeRestituisce una copia profonda di questa forma con tutta la formattazione preservata.
ShapeCollection
ShapeCollection è accessibile come ws.shapes. Contiene tutte le forme su un foglio di lavoro.
ColladaSaveOptions
Package: aspose.cells_foss
ws.shapes.add(
drawing_type: MsoDrawingType,
upper_left_row: int,
upper_left_column: int,
lower_right_row: int,
lower_right_column: int
) -> ShapeAggiunge una forma del tipo specificato. Tutti gli argomenti di posizione sono indici di riga/colonna a base zero.
add_text_box
ws.shapes.add_text_box(
upper_left_row: int,
upper_left_column: int,
lower_right_row: int,
lower_right_column: int
) -> ShapeScorciatoia per add(MsoDrawingType.TEXT_BOX, ...).
Aggiunge un grafico del tipo specificato. Tutti gli argomenti di posizione sono indici di riga/colonna a base zero.
ColladaSaveOptions
Aggiungi un rettangolo con riempimento solido.
from aspose.cells_foss import Workbook, MsoDrawingType, FillType, MsoLineDashStyle, TextAlignmentType
wb = Workbook()
ws = wb.worksheets[0]
# Add a blue rectangle spanning rows 1-5, columns 1-4 (0-based)
rect = ws.shapes.add(MsoDrawingType.RECTANGLE, 1, 1, 5, 4)
rect.name = "BlueBox"
rect.fill.fill_type = FillType.SOLID
rect.fill.fore_color = "4472C4" # blue
rect.fill.transparency = 0.0
rect.line.is_visible = True
rect.line.color = "1F3864" # dark blue
rect.line.weight = 2
rect.line.dash_style = MsoLineDashStyle.SOLID
rect.text = "Sales Summary"
rect.font.bold = True
rect.font.color = "FFFFFF" # white text
rect.font.size = 12
rect.text_horizontal_alignment = TextAlignmentType.CENTER
wb.save("shapes.xlsx")Aggiungi una casella di testo.
from aspose.cells_foss import Workbook
wb = Workbook()
ws = wb.worksheets[0]
tb = ws.shapes.add_text_box(2, 0, 5, 3)
tb.name = "NoteBox"
tb.text = "Review this section before publishing."
tb.font.italic = True
tb.font.color = "595959"
tb.is_text_wrapped = True
tb.line.is_visible = True
tb.line.color = "BFBFBF"
wb.save("textbox.xlsx")Vedi anche
- Cells Python Riferimento API home
- Aggiunge una serie di dati.
areaè una stringa di intervallo come"Sheet1!B1:B5". Impostais_vertical=Truequando i dati sono disposti in colonne.chart_typesovrascrive il tipo di grafico padre per questa serie (usato nei grafici combinati). - Riferimento alla classe Worksheet.
- Riferimento al grafico.
- Guida introduttiva