Skip to main content

Перечисление PageOrientation

Перечисление PageOrientation содержит варианты ориентации страницы документа. Может быть использована для получения / установки ориентации страниц для секции или документа в методах Section::setPageOrientation(), Section::getPageOrientation().

ЗначениеОписание
PageOrientation::LandscapeАльбомная ориентация
PageOrientation::PortraitКнижная ориентация

Примеры​


boost::optional<Block> blockOpt = document.getBlocks().getBlock(0);
if (blockOpt.has_value())
{
Section section = blockOpt.get().getSection();
section.setPageOrientation(PageOrientation::Landscape);
boost::optional<PageOrientation> pageOrientationOpt = section.getPageOrientation();
if (pageOrientationOpt.has_value())
{
PageOrientation pageOrientation = pageOrientationOpt.get();
std::printf("%s", pageOrientation == PageOrientation::Portrait ? "Portrait" : "Landscape");
}
}

Sections sections = document.getSections();

std::shared_ptr<Enumerator<Section>> enumerator = sections.getEnumerator();
while (enumerator->isValid())
{
Section section = enumerator->getCurrent();
section.setPageOrientation(PageOrientation::Landscape);
boost::optional<PageOrientation> pageOrientationOpt = section.getPageOrientation();
if (pageOrientationOpt.has_value())
{
PageOrientation pageOrientation = pageOrientationOpt.get();
std::printf("%s", pageOrientation == PageOrientation::Portrait ? "Portrait" : "Landscape");
}
}