static void ReJigRightMarginObjects_HeaderFooter(Wd.HeaderFooter item, float tableWidth, float offset) { foreach (Wd.Shape shape in item.GetShapes()) if (shape.RelativeHorizontalPosition == Wd.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionRightMarginArea) shape.Left = -shape.Width + offset; foreach (Wd.Table table in item.Range.Tables) if (offset == 0) table.AutoFitBehavior(Wd.WdAutoFitBehavior.wdAutoFitWindow); else { table.PreferredWidthType = Wd.WdPreferredWidthType.wdPreferredWidthPoints; table.PreferredWidth = tableWidth; } }