Set Top Padding to 0?

Hi there,

i have a table glossary and set its padding table’s cell like this:

cells[k].CellFormat.LeftPadding = 5;
cells[k].CellFormat.TopPadding = 0;
cells[k].CellFormat.RightPadding = 5;
cells[k].CellFormat.BottomPadding = 0;

my question is why the text cannot go to the top? How to make it go to the top - without space?
DISP SRA (9).docx (269.3 KB)
space on top

regards

@ibox The distance you are talking about is caused by Paragraph spacing before:

Thank you, Sir.

I do not see the paragraph in the document explorer and i do not put that spacing in the program. How to see it?

And how to remove that spacing?

here is the chunk codes:

// ** glosssay table:

FindReplaceOptions options = new FindReplaceOptions();

ReplaceWithHtmlEvaluator reval = new ReplaceWithHtmlEvaluator(options);
//reval.SomeData = ssGlossary;
reval.SomeData = ssGlossary.Trim();

options.ReplacingCallback = reval; // new ReplaceWithHtmlEvaluator(options);

doc.Range.Replace("[Glossary table]", String.Empty, options); 
ReplaceAction IReplacingCallback.Replacing(ReplacingArgs args)
 {
     DocumentBuilder builder = new DocumentBuilder((Document)args.MatchNode.Document);
     builder.MoveTo(args.MatchNode);

     Aspose.Words.Font font2 = builder.Font;
     font2.Name = "Calibri";
     font2.Size = 10;
    
     bool test = true;
     if(test)
     {
          builder.InsertHtml(SomeData, HtmlInsertOptions.UseBuilderFormatting | HtmlInsertOptions.RemoveLastEmptyParagraph);
     }
     else {
          builder.InsertHtml(SomeData, true);
     }
     args.Replacement = "";

     return ReplaceAction.Replace;
 }

best regard

@ibox Please try using the following code:

  builder.ParagraphFormat.SpaceBefore = 0;
  builder.ParagraphFormat.SpaceAfter = 0;
  builder.InsertHtml("<p>Some paragraph</p>", HtmlInsertOptions.UseBuilderFormatting | HtmlInsertOptions.RemoveLastEmptyParagraph);

Thank Sir,
it works
regards

1 Like