Aspose::Words::Fields::FieldAdvance::set_VerticalPosition method

FieldAdvance::set_VerticalPosition method

Sets the number of points by which the text that follows the field should be moved vertically from the top edge of the page.

void Aspose::Words::Fields::FieldAdvance::set_VerticalPosition(const System::String & value)

Examples

Shows how to insert an ADVANCE field, and edit its properties.

auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);

builder->Write(u"This text is in its normal place.");

// Below are two ways of using the ADVANCE field to adjust the position of text that follows it.
// The effects of an ADVANCE field continue to be applied until the paragraph ends,
// or another ADVANCE field updates the offset/coordinate values.
// 1 -  Specify a directional offset:
auto field = System::ExplicitCast<Aspose::Words::Fields::FieldAdvance>(builder->InsertField(FieldType::FieldAdvance, true));
field->set_RightOffset(u"5");
field->set_UpOffset(u"5");

ASSERT_EQ(field->GetFieldCode(), u" ADVANCE  \\r 5 \\u 5");

builder->Write(u"This text will be moved up and to the right.");

field = System::ExplicitCast<Aspose::Words::Fields::FieldAdvance>(builder->InsertField(FieldType::FieldAdvance, true));
field->set_DownOffset(u"5");
field->set_LeftOffset(u"100");

ASSERT_EQ(field->GetFieldCode(), u" ADVANCE  \\d 5 \\l 100");

builder->Writeln(u"This text is moved down and to the left, overlapping the previous text.");

// 2 -  Move text to a position specified by coordinates:
field = System::ExplicitCast<Aspose::Words::Fields::FieldAdvance>(builder->InsertField(FieldType::FieldAdvance, true));
field->set_HorizontalPosition(u"-100");
field->set_VerticalPosition(u"200");

ASSERT_EQ(field->GetFieldCode(), u" ADVANCE  \\x -100 \\y 200");

builder->Write(u"This text is in a custom position.");

doc->Save(get_ArtifactsDir() + u"Field.ADVANCE.docx");

See Also