Bold bullet points
Automatically bolds the first word of each bullet point that contains a colon ( : ) or a dash ( – ).
(function () {
let presentation = Api.GetPresentation();
let slides = presentation.GetAllSlides();
slides.forEach(slide => {
let shapes = slide.GetAllShapes();
shapes.forEach(shape => {
let docContent = shape.GetDocContent();
let paragraphs = docContent.GetAllParagraphs();
for (let paragraph of paragraphs) {
let indLeft = paragraph.GetIndLeft();
if (indLeft !== 0) {
let text = paragraph.GetText();
let match = text.match(/^(\s*\S+\s*[:–\-])/);
if (match) {
let boldTextStr = match[1];
let restText = text.substring(boldTextStr.length);
paragraph.RemoveAllElements();
let boldPart = paragraph.AddText(boldTextStr);
boldPart.SetBold(true);
if (restText) paragraph.AddText(restText);
}
}
}
});
});
})();
Methods used: GetPresentation, GetAllSlides, GetAllShapes, GetDocContent, GetIndLeft, GetElementsCount, RemoveAllElements, AddText, SetBold
Result