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);