変換された各ソースページには特定のレイアウトがあり、通常は SharePoint でそのままで使用できるように提供されている定義済みのレイアウトの 1 つを使用しています。 ページがモダン ページに変換されると、ソース ページのレイアウトがモダン ページに置き換えられます。 ターゲットのモダン ページはレイアウト機能が異なるため、ソース ページのレウアウトがどのようにターゲット ページのレイアウトにマッピングされるのかを把握しておくことが重要です。
Web パーツ ページ レイアウトのマッピング
ソース ページのレイアウト | ターゲット ページのレイアウト |
---|---|
![]() |
1 段組み |
![]() |
1 段組み + 2 段組み左 |
![]() |
1 段組み + 2 段組み右 |
![]() |
1 段組み + 3 段組み + 1 段組み |
![]() |
1 段組み + 3 段組み + 1 段組み |
![]() |
1 段組み + 3 段組み + 1 段組み |
![]() |
1 段組み + 1 段組み + 3 段組み + 1 段組み |
![]() |
1 段組み + 1 段組み + 3 段組み + 1 段組み |
Wiki ページ レイアウトのマッピング
ソース ページのレイアウト | ターゲット ページのレイアウト |
---|---|
![]() |
1 段組み |
![]() |
2 段組み |
![]() |
2 段組み左 |
![]() |
1 段組み + 2 段組み |
![]() |
1 段組み + 2 段組み + 1 段組み |
![]() |
3 段組み |
![]() |
1 段組み + 3 段組み |
![]() |
1 段組み + 3 段組み + 1 段組み |
発行ページ レイアウトのマッピング
発行ページには固定レイアウトがないため、発行ページ変換機能で使用される既定のレイアウト マネージャーの動作は異なります。使用されているページ レイアウトのマッピング ファイルで定義されているように Web パーツの位置に基づいて必要な行と列が生成されます。 このレイアウト動作は、PageLayoutTemplate
属性を使用してマッピング ファイルで定義され、既定は AutoDetect
です。 何らかの理由により、自動レイアウト生成を使用しない場合は、前述の Wiki ページ レイアウトの種類も使用できます。
<PageLayout Name="WelcomeLinks" AssociatedContentType="" PageLayoutTemplate="AutoDetect" PageHeader="Custom">
既定のレイアウト変換の上書き
何らかの理由でレイアウトを別の方法で変換する必要がある場合、独自のレイアウト変換コンポーネントを、以下のスニペットに示すように、組み込むことができます。
public class MyLayout : ILayoutTransformator
{
private ClientSidePage page;
public MyLayout(ClientSidePage page)
{
this.page = page;
}
public void Transform(PageLayout layout)
{
// custom layout transformation...add sections to the target page based upon the recieved page layout
switch (layout)
{
case PageLayout.Wiki_OneColumn:
case PageLayout.WebPart_FullPageVertical:
case PageLayout.Wiki_Custom:
case PageLayout.WebPart_Custom:
{
page.AddSection(CanvasSectionTemplate.OneColumn, 1);
return;
}
// add more incoming layouts...
default:
{
page.AddSection(CanvasSectionTemplate.OneColumn, 1);
return;
}
}
}
}
ILayoutTransformator layoutOverride(ClientSidePage cp)
{
return new MyLayout();
}
// Now use the custom layout transformator
PageTransformationInformation pti = new PageTransformationInformation(page)
{
// If target page exists, then overwrite it
Overwrite = true,
// Callout to your custom layout handler
LayoutTransformatorOverride = layoutOverride,
};
// Transform the page using the custom layout handled hooked up
pageTransformator.Transform(pti);