Kopieren Sie HTML in die Zwischenablage und bewahren Sie führende Räume beim Einfügen in PowerPoint auf

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Kopieren Sie HTML in die Zwischenablage und bewahren Sie führende Räume beim Einfügen in PowerPoint auf

by Anonymous » 21 Mar 2025, 08:49

Ich verwende die -Plip -Board -API , um den HTML -Inhalt des Stils in die Zwischenablage zu kopieren. Beim Einfügen in Microsoft PowerPoint möchte ich Leading Spaces für Formatierungszwecke behalten. PowerPoint tritt jedoch diese Leerzeichen auf Paste ab.

Code: Select all

/* Simplified example of the HTML code that I'm trying to copy */
const htmlText = '  Test';

async function copyToClipboard() {
try {
const data = [
new ClipboardItem({
'text/html': new Blob([htmlText], { type: 'text/html' })
})
];
await navigator.clipboard.write(data);
console.log('Plain text and HTML copied to clipboard');
} catch (err) {
console.error('Failed to copy both formats:', err);
}
}
Was ich ausprobiert habe:

Verwenden von und style = "mso-spacerun: yes" (Quelle)-ohne Erfolg. Nicht brechensräume (u+00A0), was beim Kopieren des Inhalts aus PowerPoint (z. B. in einen Code-Editor wie Intellij) zu Problemen führt, in dem Sie regelmäßige Räume wollen. PowerPoint , ohne sie in nicht blockierte Räume zu konvertieren (so bleiben sie regelmäßig Räume, wenn sie erneut kopiert werden). Hat jemand dies gelöst?>

Top