Kotlin — 透過Compose-Runtime做成使用Compose 語法產生PPTX簡報

JLin
4 min readApr 27, 2023

--

看到一個非常有趣的應用,其實Compose本身有一個叫Compose Runtime讓他透過他可以 去做一些事情

(A funny implementation written in Kotlin by Compose-runtime is the use of Kotlin code to create PowerPoint presentations in Compose style.)

下載之後,透過執行sample

(After downloading, execute the sample file)

打開Sample中的Sample.kt,點選main()左上角的執行綠色箭頭

完成後就會產生一個PPTX的檔案

(Open the Sample.kt file and click on the green button located in the top left corner to execute the sample. Afterward, you will see a generated PowerPoint file in the source folder.)

打開後可以看到一個完整的PPT,雖然不是太華麗

(You will be able to see a fully-formed PowerPoint file.)

但拿來做基本簡報很夠用了,很像是markdown產生出來的

回頭來看一下程式,基本上跟寫Compose UI一樣

(It’s possible to create a basic PowerPoint file using a syntax similar to Markdown, and then examine the Kotlin code. It likes Compose ui style)

有興趣的可以試試

參考

compose for console

video about compose runtime ui

--

--

JLin
JLin

Written by JLin

台中 / JAVA / Android /Kotlin / Kotlin Native 對於Kotlin衍生的JVM等技術 Compose for web / desktop / Ktor Server,生成式AI (Gemini/OpenAI)各式應用, 都有小興趣

No responses yet