Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Mon May 21, 2018 10:40 pm

Hi,

I'm using this awesome library to generate a single slide PPT, and I'm having an issue aligning text to top in paragraph!

I've tried the following:
Code: Select all
  textParagraph.FontAlignment = Spire.Presentation.FontAlignmentType.Top;
textParagraph.FirstTextRange.Paragraph.ParagraphProperties.FontAlignment = Spire.Presentation.FontAlignmentType.Top;
textParagraph.FirstTextRange.Paragraph.FontAlignment = Spire.Presentation.FontAlignmentType.Top;

And none of these lines work !
Second; I'd like to know why the bullet color is not working >.<, What I'm doing wrong?
Why I need this? becuase I'm reserving a space for a single paragraph and when it's not all filled the text goes to the middle.

I'm waiting any suggestion, or help.

Example from my code:
Code: Select all
var ppt = new Spire.Presentation.Presentation();
Spire.Presentation.ISlide slide = ppt.Slides[0];
System.Drawing.SizeF pptSize = ppt.SlideSize.Size;
//Set background
string bgFile = backgroundImage;
var bgRect = new System.Drawing.RectangleF(new System.Drawing.PointF(0, 0), pptSize);
slide.Shapes.AppendEmbedImage(Spire.Presentation.ShapeType.Rectangle, bgFile, bgRect);


var eduTitleRect = new System.Drawing.RectangleF(55, 363, 300, 20);
Spire.Presentation.IAutoShape eduTitleShape = slide.Shapes.AppendShape(Spire.Presentation.ShapeType.Rectangle, eduTitleRect);
eduTitleShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;
eduTitleShape.ShapeStyle.LineColor.Color = System.Drawing.Color.Empty;
Spire.Presentation.TextParagraph eduTitlePara = eduTitleShape.TextFrame.Paragraphs[0];
eduTitlePara.Text = "EDUCATION AND PROFESSIONAL CERTIFICATES";
eduTitlePara.FirstTextRange.IsBold = Spire.Presentation.TriState.True;
eduTitlePara.FirstTextRange.FontHeight = 11;
eduTitlePara.FirstTextRange.LatinFont = new Spire.Presentation.TextFont("Arial");
eduTitlePara.FirstTextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
eduTitlePara.FirstTextRange.Fill.SolidColor.Color = System.Drawing.Color.FromArgb(0, 145, 200);
eduTitlePara.Alignment = Spire.Presentation.TextAlignmentType.Left;

var eduRect = new System.Drawing.RectangleF(55, 325, 300, 150);
Spire.Presentation.IAutoShape eduShape = slide.Shapes.AppendShape(Spire.Presentation.ShapeType.Rectangle, eduRect);
eduShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;
eduShape.ShapeStyle.LineColor.Color = System.Drawing.Color.Empty;
foreach (var item in educationList)
{
    var textParagraph = new Spire.Presentation.TextParagraph();
    textParagraph.Text = $" {item.BSc}, {item.Institution}";
    textParagraph.Alignment = Spire.Presentation.TextAlignmentType.Left;
    textParagraph.FontAlignment = Spire.Presentation.FontAlignmentType.Top;
    textParagraph.FirstTextRange.IsBold = Spire.Presentation.TriState.False;
    textParagraph.FirstTextRange.FontHeight = 10.5F;
    summaryPara.FirstTextRange.LatinFont = new Spire.Presentation.TextFont("Arial");
    textParagraph.FirstTextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
    textParagraph.FirstTextRange.Fill.SolidColor.Color = System.Drawing.Color.FromArgb(124, 132, 138);
    textParagraph.FirstTextRange.Paragraph.ParagraphProperties.FontAlignment = Spire.Presentation.FontAlignmentType.Top;
    textParagraph.FirstTextRange.Paragraph.ParagraphBulletColor.Color = System.Drawing.Color.FromArgb(00, 176, 240);
    textParagraph.BulletType = Spire.Presentation.TextBulletType.Symbol;
    textParagraph.BulletColor.Color = System.Drawing.Color.FromArgb(0, 145, 200);
    textParagraph.BulletColor.ColorType = Spire.Presentation.Drawing.ColorType.RGB;
    eduShape.TextFrame.Paragraphs.Append(textParagraph);
}

//Set transition of slide
slide.SlideShowTransition.Type = Spire.Presentation.Drawing.Transition.TransitionType.Cover;
//Save the file
ppt.SaveToFile(fileFullPath, Spire.Presentation.FileFormat.Pptx2010);

bfataftah
 
Posts: 3
Joined: Mon May 14, 2018 4:49 pm

Tue May 22, 2018 9:33 am

Hello,

Thanks for your post.
Here are the answers to your questions.
1.Please refer to the below code to set vertical alignment.
Code: Select all
eduShape.TextFrame.AnchoringType = TextAnchorType.Top;

2.I have noticed the bullet color issue and logged it in our bug tracking system. Once there is any update, i will let you know.

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Thu May 24, 2018 10:16 am

Hello,

After an in-depth investigation, we found the workaround.
Before setting the bullet color, you need declare "CustomBulletColor" to be true. Please refer to the below code.
Code: Select all
textParagraph.CustomBulletColor = true;
textParagraph.BulletColor.Color = Color.FromArgb(0, 145, 200);


Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Mon Aug 13, 2018 10:32 pm

@Wade.shao sorry for the late response,

Thank you for your support, I'm finally able to format my whole slides full due to your help thanks again.

bfataftah
 
Posts: 3
Joined: Mon May 14, 2018 4:49 pm

Tue Aug 14, 2018 1:25 am

Dear bfataftah,

Glad to hear that.
Just feel free to contact us if you need any assistance.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Presentation