Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Insert text data from file
Insert text data from file [message #40916] Mon, 07 October 2013 18:49 Go to previous message
iST1 is currently offline  iST1
Messages: 107
Registered: August 2013
Experienced Member
I'm trying to load txt file with transform base code LoadImage, but occured 2 problem:
1) it seems that QTF doesn't work with RichPara, but i use it for create new line (&);
2) rus code page

File:
line 1
line 2
line 3
строка 4
строка 5
строка 6

=>

`[`& line 1`]`[`& line 2`]`[`& line 3`]`[`&  4`]`[`&  5`]`[`&  6`]


void RichEdit::LoadTxt()
{
	FileSel fsel;
 	fsel.Type("Текстовые файлы ", "*.txt");

	static String dir = fsel.GetActiveDir();
	fsel.ActiveDir(dir);
	
	if(fsel.ExecuteOpen(t_("Выберите текстовый файл для вставки"))) {
		dir = fsel.GetActiveDir();

		FileIn fi;
		if(!fi.Open(~fsel)) {
			Exclamation(NFormat(t_("Ошибка открытия файла [* \1%s\1]."), ~fsel));
			return;
		}

		RichPara para;
		RichPara::CharFormat fmt;
		while (!fi.IsEof()) {
			para.Cat(DeQtf("[& " + fi.GetLine() + "]"), fmt);
		}

		RichText clip;
		clip.Cat(para);
		
		RemoveSelection();
		Insert(GetCursor(), clip, false);
		Finish();		
	}
}
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem copying from RichEdit to Word
Next Topic: Allow line-break after '-' sign within a word?
Goto Forum:
  


Current Time: Sun Apr 28 08:13:45 CEST 2024

Total time taken to generate the page: 0.80699 seconds