rtf

package module
v0.0.0-...-e46944e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 5 Imported by: 0

README

Rtf

Strip rtf markup from string

StripRichTextFormat function removes rtf markup from string and returns new string.

Rtf text

{\rtf1\ansi\deff0\sdeasyworship2
{\fonttbl{\f0 Tahoma;}}
{\colortbl ;}
{\pard\sdlistlevel0\qc\qdef\sdewparatemplatestyle101{\*\sdasfactor 1}{\*\sdasbaseline 72.9}\sdastextstyle101\plain\sdewtemplatestyle101\fs146{\*\sdfsreal 72.9}{\*\sdfsdef 72.9}\sdfsauto hello\par}
{\pard\sdslidemarker\sdlistlevel0\qc\qdef\sdewparatemplatestyle101\plain\sdewtemplatestyle101\fs146{\*\sdfsreal 72.9}{\*\sdfsdef 72.9}\sdfsauto\par}
{\pard\sdlistlevel0\qc\qdef\sdewparatemplatestyle101\plain\sdewtemplatestyle101\fs146{\*\sdfsreal 72.9}{\*\sdfsdef 72.9}\sdfsauto hello\par}
}

becomes

hello

hello

code

package main

import (
	"io/ioutil"
	"os"

	"github.com/J45k4/rtf"
)

func main() {
	b, _ := ioutil.ReadFile("rtftext.rtf")
	f, _ := os.Create("text.txt")
	f.WriteString(rtf.StripRichTextFormat(string(b)))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StripRichTextFormat

func StripRichTextFormat(inputRtf string) string

Removes rtf characters from string and returns the new string.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL