StoryFragment 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表 XPS 文件內完整或部分的劇本。
public ref class StoryFragment
public ref class StoryFragment : System::Collections::Generic::IEnumerable<System::Windows::Documents::DocumentStructures::BlockElement ^>, System::Windows::Markup::IAddChild
public class StoryFragment
[System.Windows.Markup.ContentProperty("BlockElementList")]
public class StoryFragment : System.Collections.Generic.IEnumerable<System.Windows.Documents.DocumentStructures.BlockElement>, System.Windows.Markup.IAddChild
type StoryFragment = class
interface IAddChild
[<System.Windows.Markup.ContentProperty("BlockElementList")>]
type StoryFragment = class
interface IAddChild
interface seq<BlockElement>
interface IEnumerable
[<System.Windows.Markup.ContentProperty("BlockElementList")>]
type StoryFragment = class
interface seq<BlockElement>
interface IEnumerable
interface IAddChild
Public Class StoryFragment
Public Class StoryFragment
Implements IAddChild, IEnumerable(Of BlockElement)
- 繼承
-
StoryFragment
- 屬性
- 實作
範例
下列範例顯示 <StoryFragment>
XML 檔規格 (XPS) 檔的一部分。
<StoryFragment StoryName="DocumentBody" FragmentType="Content">
<SectionStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1Heading1" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P1" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P2" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P3" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P4" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P5" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1Heading2" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P6" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P7" />
</ParagraphStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R1C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R1C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R2C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R2C2P1" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="R2C2P2" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R3C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R3C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R4C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R4C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R5C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R5C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
</StoryFragment>
備註
XPS 檔中的 XPS 故事大致類似于新聞或雜誌中的故事。 它是文字和圖形內容的一段,通常是在單一 XPS 檔中的單一主題。 一般而言,它會跨越多個頁面,但可以短于看板的方塊式劇本等頁面。 本文也可以不連續,就像第 4 頁繼續的前端新聞故事一樣。 因此,指定的頁面可以有一個以上的本文,以及多個故事的一部分。 頁首或頁尾也是一種特殊的故事,完全包含在單一頁面上。
StoryFragment表示本文的所有或部分。 它永遠不能跨越多個頁面,但可以佔用整個頁面,或與其他片段共用頁面。 如果本文位於多個頁面上,則每個頁面上的每個部分都是個別的片段。 雖然劇本可以有不連續的片段集,但不能有片段本身不連續。
只有專案 StoryFragments 可以是 的父代 StoryFragment 。 內 StoryFragment 元素的位置 StoryBreak 表示本文是否包含在多個片段中,以及其他片段是否在目前片段之前或之後。
當某個 StoryFragment 結構元素中間的 結尾時,假設是 <TableRowGroupStructure>
,則 XPS 檔產生應用程式必須插入元素的適當結束卷 (標,在此案例 </TableRowGroupStructure>
中) 標記之前 </StoryFragment>
,即使結構是在稍後片段中繼續執行也一樣。 (這是確保 內的 StoryFragment 專案樹狀結構有效的 XML.) 繼續本文的片段必須以中斷結構的開頭標記開始。 中斷結構的整個樹狀結構必須以相同方式處理 (,但有一個例外狀況,如下所述) :必須針對中中斷點上方的每個不相符的起始標籤新增結束標籤。
當腳本中斷緊接在標記之後 </TableCellStructure>
時,就會套用例外狀況,則產生的應用程式必須在片段中繼續本文的對應點插入空的資料表資料格結構 (<TableCellStructure></TableCellStructure>
) 。 這是必要的,因此取用需要合併指定劇本所有片段的應用程式可以使用簡單的演算法來執行此動作。
例如,假設應用程式想要將下列內容新增至 XPS 檔:
<SectionStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="SomeContent" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="MoreContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="EvenMoreContent" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="LastContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
如果分頁符號在 「SomeContent」 的 之後 </TableCellStructure>
強制結束片段,應用程式必須建立分割,如下列範例所示:
<StoryFragment StoryName="MyStory" FragmentType="Content">
<SectionStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="SomeContent" />
</ParagraphStructure>
</TableCellStructure>
<!-- lines from here to end of fragment added by producer-->
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
</StoryFragment>
<StoryFragment StoryName="MyStory" FragmentType="Content">
<SectionStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<!-- extra cell added by producer-->
</TableCellStructure>
<!-- lines from here to start of fragment added by producer-->
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="MoreContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="EvenMoreContent" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="LastContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
</StoryFragment>
讀取檔的應用程式可能需要合併此內容。 例如,假設 XPS 檢視器具有 [將整個故事複製到剪貼簿 ] 按鈕;或將劇本傳遞至語音合成器的盲目應用程式的 XPS 。 讀取檔的某些應用程式可能需要合併本文片段的子集。 例如,只要三鍵即可將整個段落複製到剪貼簿的功能,每當段落跨越分頁符號時,就必須執行合併,因為這類段落會在兩 StoryFragment 個 s 之間分割。
若要合併,請使用此演算法:
</StoryFragment>
從要合併的第一個片段結尾刪除 ,<StoryFragment>
並從第二個開頭刪除 。如果第一個片段的最後一個結束記號的類型與第二個片段的第一個開頭標記相同 (,而且它們不是
<NamedElement>
) 標記,請刪除兩者。重複步驟 2,直到兩個片段處於下列 其中一 種狀態:
在前置片段的最後一個結束記號之間,尾端片段的第一個開始標籤之間不再有類型相符。
前置片段的最後一個結束記號,尾端片段的第一個開始標記是兩
<NamedElement>
個標記。
在上述範例中,如果產生應用程式尚未新增空儲存格,則合併片段會產生資料表,其中第一個資料列只有一個包含 「SomeContent」 和 「MoreContent」 參照的儲存格,而不是包含兩個儲存格的原始第一個資料列,每個儲存格都包含單一參考
合併整個本文時,應該針對屬於相同本文的每個後續片段重複演算法。 屬於本文的片段會在 專案中編制索引 <Story>
。 請參閱 XML 檔規格的第 9.1.15 節, (XPS) 規格,您可以在 XPS:規格和授權下載取得。 指定本文的最後一個片段會有元素做為其最後一個 StoryBreak 子系。
建構函式
StoryFragment() |
初始化 StoryFragment 類別的新執行個體。 |
屬性
FragmentName |
取得或設定 Story 片段的名稱。 |
FragmentType |
取得或設定片段的型別。 |
StoryName |
取得或設定 Story 的名稱。 |
方法
Add(BlockElement) |
將區塊加入至 Story 片段。 |
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
GetType() |
取得目前執行個體的 Type。 (繼承來源 Object) |
MemberwiseClone() |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
ToString() |
傳回代表目前物件的字串。 (繼承來源 Object) |
明確介面實作
IAddChild.AddChild(Object) |
此成員支援 .NET Framework 基礎結構,並不能直接使用於您的程式碼中。 |
IAddChild.AddText(String) |
將節點的文字內容加入物件中。 |
IEnumerable.GetEnumerator() |
尚未實作這個方法。 |
IEnumerable<BlockElement>.GetEnumerator() |
尚未實作這個方法。 |
擴充方法
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將推出:在 2024 年,我們將隨著內容的意見反應機制逐步淘汰 GitHub 問題,並以新的意見反應系統來取代。 如需詳細資訊,請參閱提交並檢視相關的意見反應