A
Andrey Dzizenko
Hi!
Could anyone please explain me how to work with Word table borders
correctly?
I wrote a method like that:
private void ProcessBorder(Range range, WdBorderType borderType)
{
SmartLog.Log();
Border border = range.Cells.Borders[borderType];
if (border.Visible)
{
// Line is my own class
Line line = new Line();
line.Color = (int)border.Color;
line.Start.Top.FromPoints(
(float)_application.Selection.get_Information(
WdInformation.wdVerticalPositionRelativeToPage)
+ ((borderType == WdBorderType.wdBorderBottom) ? range.Cells.Height : 0)
);
line.Start.Left.FromPoints(
(float)_application.Selection.get_Information(
WdInformation.wdHorizontalPositionRelativeToPage)
+ ((borderType == WdBorderType.wdBorderRight) ? range.Cells.Width: 0)
);
// Code for getting end point of line
// ...
}
}
But that method sets incorrect position of borders. Maybe I'm completely
wrong.
Thank you in advance.
Could anyone please explain me how to work with Word table borders
correctly?
I wrote a method like that:
private void ProcessBorder(Range range, WdBorderType borderType)
{
SmartLog.Log();
Border border = range.Cells.Borders[borderType];
if (border.Visible)
{
// Line is my own class
Line line = new Line();
line.Color = (int)border.Color;
line.Start.Top.FromPoints(
(float)_application.Selection.get_Information(
WdInformation.wdVerticalPositionRelativeToPage)
+ ((borderType == WdBorderType.wdBorderBottom) ? range.Cells.Height : 0)
);
line.Start.Left.FromPoints(
(float)_application.Selection.get_Information(
WdInformation.wdHorizontalPositionRelativeToPage)
+ ((borderType == WdBorderType.wdBorderRight) ? range.Cells.Width: 0)
);
// Code for getting end point of line
// ...
}
}
But that method sets incorrect position of borders. Maybe I'm completely
wrong.
Thank you in advance.