Connect with us

Code

ComposePPT – Generating PowerPoint presentation using Compose

An experimental UI toolkit for generating PowerPoint presentation files(.pptx) using Compose. Inspired by Glance and Mosaic.

Why ComposePPT?

This project is created just for fun and demonstrate the power of Compose Runtime muscle.

Usage

There is a single entry point called runComposePPT to create a presentation. In order to add a content, you must use Slide composable to add slides to a presentation first. Then you can place the composables inside the Slide composable.

fun main() {
    runComposePPT {
        // Slide composable must be used to place other composables 
        Slide {
            Text("Hello from composePPT")
        }
    }
}

After running the above code, you will see a presentation file composePPT.pptx in your project root folder. You can modify the presentation file name as below.

runComposePPT(presentationFileName = "myPresentation") { ... }

Calling runComposePPT several times is allowed if you want to create all presentations at once.

fun main() {
    runComposePPT(presentationFileName = "firstPresentation") { ... }
    runComposePPT(presentationFileName = "secondPresentation") { ... }
}

You can also use side effects and remember composable function.

ComposePPT limitations

You can only use LaunchedEffect to launch a coroutine. Even though using rememberCoroutineScope will work, it will not terminate the program. So you have to manually terminate it in order the presentation file to be created.

ComposePPT on GitHub: https://github.com/fgiris/composePPT
Platform: Android
⭐️:111
Advertisement

Trending