Skip to main content

TextBox

Struct TextBox 

Source
pub struct TextBox { /* private fields */ }
Expand description

文本框(python-pptx 的 shapes.add_textbox 对应)。

Implementations§

Source§

impl TextBox

Source

pub fn new(name: impl Into<String>) -> Self

新建一个文本框。

Source

pub fn from_sp(sp: OxmlSp) -> Self

从 oxml OxmlSp 构造。

Source

pub fn text_frame(&self) -> &TextBody

文本帧不可变引用。

Source

pub fn text_frame_mut(&mut self) -> &mut TextBody

文本帧可变引用。

Source

pub fn set_text(&mut self, text: &str) -> &mut TextBody

替换全部文本(每行一个段落)。

替换后旧的 Run 属性(字体、颜色、加粗)会被清除;如需保留请直接操作 TextBox::text_frame_mut

Source

pub fn text(&self) -> String

取文本(把全部段落拼起来,行间 \n)。

Source

pub fn set_word_wrap(&mut self, v: bool)

单词换行便捷方法。

Source

pub fn set_auto_size(&mut self, v: MsoAutoSize)

自动调整便捷方法。

Source

pub fn set_vertical_anchor(&mut self, v: MsoAnchor)

垂直对齐便捷方法。

Source

pub fn set_outer_shadow(&mut self, shadow: ShadowEffect)

设置外阴影(<a:outerShdw>)。详见 crate::shape::AutoShape::set_outer_shadow

Source

pub fn set_inner_shadow(&mut self, shadow: ShadowEffect)

设置内阴影(<a:innerShdw>)。详见 crate::shape::AutoShape::set_inner_shadow

Source

pub fn set_glow(&mut self, glow: GlowEffect)

设置发光(<a:glow>)。详见 crate::shape::AutoShape::set_glow

Source

pub fn set_soft_edge(&mut self, rad: i64)

设置柔化边缘(<a:softEdge>)。详见 crate::shape::AutoShape::set_soft_edge

Source

pub fn set_reflection(&mut self, reflection: ReflectionEffect)

设置反射(<a:reflection>)。详见 crate::shape::AutoShape::set_reflection

Source

pub fn clear_effects(&mut self)

清除所有效果。详见 crate::shape::AutoShape::clear_effects

Source

pub fn set_3d_rotation(&mut self, lat_deg: f64, lon_deg: f64, rev_deg: f64)

设置三维旋转。详见 crate::shape::AutoShape::set_3d_rotation

Source

pub fn set_3d_extrusion(&mut self, height_emu: i32, color: Option<Color>)

设置三维拉伸。详见 crate::shape::AutoShape::set_3d_extrusion

Source

pub fn set_3d_bevel( &mut self, top_w: i32, top_h: i32, bottom_w: i32, bottom_h: i32, )

设置三维棱台。详见 crate::shape::AutoShape::set_3d_bevel

Source

pub fn set_3d_material(&mut self, material: MaterialPreset)

设置三维材质预设。详见 crate::shape::AutoShape::set_3d_material

Source

pub fn clear_3d(&mut self)

清除所有三维效果。详见 crate::shape::AutoShape::clear_3d

Source

pub fn scene_3d(&self) -> Option<&Scene3d>

取三维场景引用。详见 crate::shape::AutoShape::scene_3d

Source

pub fn scene_3d_mut(&mut self) -> &mut Option<Scene3d>

取三维场景可变引用。详见 crate::shape::AutoShape::scene_3d_mut

Source

pub fn sp_3d(&self) -> Option<&Sp3d>

取形状三维属性引用。详见 crate::shape::AutoShape::sp_3d

Source

pub fn sp_3d_mut(&mut self) -> &mut Option<Sp3d>

取形状三维属性可变引用。详见 crate::shape::AutoShape::sp_3d_mut

Source

pub fn locks(&self) -> Option<&ShapeLocks>

读取形状锁定(<a:spLocks>)。详见 crate::shape::AutoShape::locks

Source

pub fn locks_mut(&mut self) -> &mut ShapeLocks

读取形状锁定的可变引用。详见 crate::shape::AutoShape::locks_mut

Source

pub fn lock_select(&mut self, locked: bool)

便捷锁定:禁止选中。详见 crate::shape::AutoShape::lock_select

Source

pub fn lock_move(&mut self, locked: bool)

便捷锁定:禁止移动。详见 crate::shape::AutoShape::lock_move

Source

pub fn lock_resize(&mut self, locked: bool)

便捷锁定:禁止缩放。详见 crate::shape::AutoShape::lock_resize

Source

pub fn lock_rotate(&mut self, locked: bool)

便捷锁定:禁止旋转。详见 crate::shape::AutoShape::lock_rotate

Source

pub fn lock_group(&mut self, locked: bool)

便捷锁定:禁止组合。详见 crate::shape::AutoShape::lock_group

Source

pub fn clear_locks(&mut self)

清除所有锁定。详见 crate::shape::AutoShape::clear_locks

Source

pub fn set_lock(&mut self, lock_type: LockType, locked: bool)

统一锁定入口:按 crate::LockType 设置指定锁定。 详见 crate::shape::AutoShape::set_lock

Source

pub fn style(&self) -> Option<&ShapeStyle>

读取主题样式引用(<p:style>)。详见 crate::shape::AutoShape::style

Source

pub fn set_style(&mut self, style: ShapeStyle)

设置主题样式引用。详见 crate::shape::AutoShape::set_style

Source

pub fn clear_style(&mut self)

清除主题样式引用。详见 crate::shape::AutoShape::clear_style

Trait Implementations§

Source§

impl Clone for TextBox

Source§

fn clone(&self) -> TextBox

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextBox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextBox

Source§

fn default() -> TextBox

Returns the “default value” for a type. Read more
Source§

impl Shape for TextBox

Source§

fn id(&self) -> u32

形状唯一 ID(在所属 slide 内)。 Read more
Source§

fn set_id(&mut self, id: u32)

设置 ID。
Source§

fn name(&self) -> &str

形状名。
Source§

fn set_name(&mut self, name: String)

设置形状名。
Source§

fn shape_type(&self) -> &'static str

形状类型(如 "text_box" / "picture" / …)。 Read more
Source§

fn left(&self) -> Emu

左上角 x(EMU)。
Source§

fn set_left(&mut self, emu: Emu)

设置左上角 x。
Source§

fn top(&self) -> Emu

左上角 y(EMU)。
Source§

fn set_top(&mut self, emu: Emu)

设置左上角 y。
Source§

fn width(&self) -> Emu

宽(EMU)。
Source§

fn set_width(&mut self, emu: Emu)

设置宽。
Source§

fn height(&self) -> Emu

高(EMU)。
Source§

fn set_height(&mut self, emu: Emu)

设置高。
Source§

fn rotation(&self) -> f64

旋转角度(度数,正向顺时针)。 Read more
Source§

fn set_rotation(&mut self, deg: f64)

设置旋转角度。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V