4. In $\triangle A B C$, $C D$ is the altitude, $C E$ is the angle bisector, and $C D=12 \text{ cm}, A C=15 \text{ cm}, B C=20 \text{ cm}$. Then $C E=$ $\qquad$ .
4. $\frac{60 \sqrt{2}}{7} \mathrm{~cm}$ or $12 \sqrt{2} \mathrm{~cm}$.

Since the foot of the altitude $C D$ from $\triangle A B C$ can be on side $A B$ or on the extension of side $B A$, we need to consider two cases.
(1) As shown in Figure 4, if
$\triangle A B C$ is an acute triangle,
then the foot $D$ is on side $A B$.
By the Pythagorean theorem, we have
$$
\begin{array}{l}
A D=9 \mathrm{~cm}, \\
B D=16 \mathrm{~cm} .
\end{array}
$$

Thus, $A B=A D+B D=25(\mathrm{~cm})$,
By the converse of the Pythagorean theorem, $\angle A C B=90^{\circ}$. Therefore,
$$
\frac{1}{2}(15 C E+20 C E) \sin 45^{\circ}=\frac{1}{2} \times 15 \times 20 \text {. }
$$

Solving this, we get $C E=\frac{60 \sqrt{2}}{7}(\mathrm{~cm})$.
(2) As shown in Figure 5, if
$\triangle A B C$ is an obtuse triangle,
then the foot $D$ is on the extension of side $B A$. It is easy to see that
$$
\begin{array}{c}
A D=9 \mathrm{~cm}, \\
B D=16 \mathrm{~cm}, \\
A B=B D-A D=7(\mathrm{~cm}) .
\end{array}
$$

Since $C E$ bisects $\angle A C B$,
$$
\text { hence } \frac{A E}{B E}=\frac{A C}{B C}=\frac{15}{20}=\frac{3}{4} \text {. }
$$

Therefore, $B E=4 \mathrm{~cm}, A E=3 \mathrm{~cm}$.
Thus, $D E=A D+A E=12(\mathrm{~cm})$.
Hence, $C E=\sqrt{C D^{2}+D E^{2}}=\sqrt{12^{2}+12^{2}}=12 \sqrt{2}(\mathrm{~cm})$.