| float clientWidth = section.PageSetup.ClientWidth; float clientHeight = section.PageSetup.PageSize.Height - section.PageSetup.Margins.Top - section.PageSetup.Margins.Bottom; float scalePer = 100; if (picture.Width > clientWidth) { scalePer = clientWidth / imageWidth * 100; } else if (picture.Height > clientHeight) { scalePer = clientHeight / imageHeight * 100; } // This will resizes the width and height. picture.WidthScale = scalePer; picture.HeightScale = scalePer; |
|
//Gets the table cell from table.
WTableCell tableCell = table.Rows[0].Cells[0];
float cellSpacing = 0;
//Gets the spacing value from the row format.
if (tableCell.OwnerRow != null && (tableCell.OwnerRow as WTableRow).RowFormat.CellSpacing > 0)
cellSpacing = (tableCell.OwnerRow as WTableRow).RowFormat.CellSpacing;
//Gets the spacing value from the table format.
else if (tableCell.OwnerRow != null && tableCell.OwnerRow.Owner != null && (tableCell.OwnerRow.Owner as WTable).TableFormat.CellSpacing > 0)
cellSpacing = (tableCell.OwnerRow.Owner as WTable).TableFormat.CellSpacing;
//Gets the client width of cell excluding the margins and spacing values.
float clientWidth = tableCell.Width - (tableCell.CellFormat.Paddings.Left + tableCell.CellFormat.Paddings.Right) - (cellSpacing * 2);
float scalePercentage = 100;
//Calculates value for width scale factor.
if (picture.Width > clientWidth)
scalePercentage = clientWidth / picture.Width * 100;
//This will resizes the width.
picture.WidthScale *= scalePercentage / 100; |
" + sbquestion.ToString().Replace("\\n", "
").Replace("\r", "").Replace("\a", "").Replace("\f", "") + "
|
paragraph.ParagraphFormat.SpaceAfterAuto = false;
paragraph.ParagraphFormat.SpaceBeforeAuto = false; |