Sub Макрос9()
'
' Макрос9 Макрос
'
'
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddTextEffect( _
PowerPlusWaterMarkObject98005865, "ДЛЯ СЛУЖЕБНОГО ПОЛЬЗОВАНИЯ", "Calibri" _
, 1, False, False, 0, 0).Select
Selection.ShapeRange.Name = "PowerPlusWaterMarkObject98005865"
Selection.ShapeRange.TextEffect.NormalizedHeight = False
Selection.ShapeRange.Line.Visible = False
Selection.ShapeRange.Fill.Visible = True
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(192, 192, 192)
Selection.ShapeRange.Fill.Transparency = 0.5
Selection.ShapeRange.Rotation = 315
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = CentimetersToPoints(2.49)
Selection.ShapeRange.Width = CentimetersToPoints(20.77)
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapNone
Selection.ShapeRange.WrapFormat.Type = 3
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.Left = wdShapeCenter
Selection.ShapeRange.Top = wdShapeCenter
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
c++builder 2009, MS Word 2010, WaterMark: проблема с разделами
Есть документ созданный в office word 2000. в документе имеются разрывы страниц. Используя word 2010 записан макрос создания настраиваемой подложки:
(подложка вставляется на все станицы документа без проблем)
Код:
Код транслирован в с++:
Код:
WordApplication1->Selection->Select();
//WordDocument1->Application->Document->Selection->Range->Select();
WordDocument1->Application->ActiveWindow->ActivePane->View->SeekView = WdSeekView::wdSeekCurrentPageHeader;
WordDocument1->Application->Selection->HeaderFooter->Shapes->AddTextEffect(Office_xp::MsoPresetTextEffect::msoTextEffect2,
WideString(Memo1->Lines->Text).c_bstr(),WideString("Arial").c_bstr(),60.0,
MsoTriState::msoFalse,MsoTriState::msoFalse,0,0)->Select();
WordDocument1->Application->Selection->ShapeRange->Name = WideString("PowerPlusWaterMarkObject1").c_bstr();
WordDocument1->Application->Selection->ShapeRange->TextEffect->NormalizedHeight = MsoTriState::msoFalse;
//WordDocument1->Application->Selection->ShapeRange->TextEffect->set_FontSize(50);
WordDocument1->Application->Selection->ShapeRange->Line->Visible = MsoTriState::msoFalse;
WordDocument1->Application->Selection->ShapeRange->Fill->Visible = MsoTriState::msoTrue;
WordDocument1->Application->Selection->ShapeRange->Fill->Solid();
ordDocument1->Application->Selection->ShapeRange->Fill->Transparency = 0.5;
WordDocument1->Application->Selection->ShapeRange->Rotation = 320;
WordDocument1->Application->Selection->ShapeRange->LockAspectRatio = MsoTriState::msoTrue;
WordDocument1->Application->Selection->ShapeRange->Height = WordDocument1->Application->CentimetersToPoints(2.58);
WordDocument1->Application->Selection->ShapeRange->Width = WordDocument1->Application->CentimetersToPoints(18.07);
WordDocument1->Application->Selection->ShapeRange->WrapFormat->AllowOverlap = MsoTriState::msoTrue;
WordDocument1->Application->Selection->ShapeRange->WrapFormat->Side = Word_xp::WdWrapSideType::wdWrapBoth; //wdWrapLargest
WordDocument1->Application->Selection->ShapeRange->WrapFormat->Type = Word_xp::WdWrapType::wdWrapNone; //wdWrapNone
WordDocument1->Application->Selection->ShapeRange->RelativeHorizontalPosition = Word_xp
::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
WordDocument1->Application->Selection->ShapeRange->RelativeVerticalPosition = Word_xp
::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
WordDocument1->Application->Selection->ShapeRange->Left = Word_xp::WdShapePosition::wdShapeCenter;
WordDocument1->Application->Selection->ShapeRange->Top = Word_xp::WdShapePosition::wdShapeCenter;
WordDocument1->Application->ActiveWindow->ActivePane->View->SeekView = WdSeekView::wdSeekMainDocument;
//WordDocument1->Application->Document->Selection->Range->Select();
WordDocument1->Application->ActiveWindow->ActivePane->View->SeekView = WdSeekView::wdSeekCurrentPageHeader;
WordDocument1->Application->Selection->HeaderFooter->Shapes->AddTextEffect(Office_xp::MsoPresetTextEffect::msoTextEffect2,
WideString(Memo1->Lines->Text).c_bstr(),WideString("Arial").c_bstr(),60.0,
MsoTriState::msoFalse,MsoTriState::msoFalse,0,0)->Select();
WordDocument1->Application->Selection->ShapeRange->Name = WideString("PowerPlusWaterMarkObject1").c_bstr();
WordDocument1->Application->Selection->ShapeRange->TextEffect->NormalizedHeight = MsoTriState::msoFalse;
//WordDocument1->Application->Selection->ShapeRange->TextEffect->set_FontSize(50);
WordDocument1->Application->Selection->ShapeRange->Line->Visible = MsoTriState::msoFalse;
WordDocument1->Application->Selection->ShapeRange->Fill->Visible = MsoTriState::msoTrue;
WordDocument1->Application->Selection->ShapeRange->Fill->Solid();
ordDocument1->Application->Selection->ShapeRange->Fill->Transparency = 0.5;
WordDocument1->Application->Selection->ShapeRange->Rotation = 320;
WordDocument1->Application->Selection->ShapeRange->LockAspectRatio = MsoTriState::msoTrue;
WordDocument1->Application->Selection->ShapeRange->Height = WordDocument1->Application->CentimetersToPoints(2.58);
WordDocument1->Application->Selection->ShapeRange->Width = WordDocument1->Application->CentimetersToPoints(18.07);
WordDocument1->Application->Selection->ShapeRange->WrapFormat->AllowOverlap = MsoTriState::msoTrue;
WordDocument1->Application->Selection->ShapeRange->WrapFormat->Side = Word_xp::WdWrapSideType::wdWrapBoth; //wdWrapLargest
WordDocument1->Application->Selection->ShapeRange->WrapFormat->Type = Word_xp::WdWrapType::wdWrapNone; //wdWrapNone
WordDocument1->Application->Selection->ShapeRange->RelativeHorizontalPosition = Word_xp
::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
WordDocument1->Application->Selection->ShapeRange->RelativeVerticalPosition = Word_xp
::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
WordDocument1->Application->Selection->ShapeRange->Left = Word_xp::WdShapePosition::wdShapeCenter;
WordDocument1->Application->Selection->ShapeRange->Top = Word_xp::WdShapePosition::wdShapeCenter;
WordDocument1->Application->ActiveWindow->ActivePane->View->SeekView = WdSeekView::wdSeekMainDocument;
Доступ к объекту документа проводится на основе:
Транслированный код вставляет watermark только до встречи первого разрыва (в доках 2000го офиса), в доках офиса 2010 вставляет на все пространство документа.
Вопрос: как заставить c++builder вставлять watermark на все страницы документа созданного в word 2000?
Заранее спасибо!