Hi Iva,
Sorry for disturbing again. i was created MSWord docx and i created a print template doc. example am i given below. first load all xml data to one collection then am importing all data to word to raddocument. then in this document am finding like this "<text>". then i have replaced to orinigal value. but i could not replace raddocument? ca u tell me how to do this situation? thanks in advance.
This sample of ms word content.
Player Card Profile
Profile
|
|
First Name
|
<FirstName> <LastName> <MIName>
|
Status
|
<status>
|
|
i have replace of <FirstName> like.
am writing one method like this.
private string GetActualValue(string originalValue, List<player> Players)
{
string myResult = originalValue;
if (originalValue.Substring(0, 1) == "<" && originalValue.Substring(originalValue.Length - 1, 1) == ">")
{
var result = from myPlayers in Players
where myPlayers.Title.Equals (originalValue.Substring (1,originalValue.Length-2))
select myPlayers;
if (result.ToList ().Count > 0 )
{
player myPlayer = (player)result.ToList()[0];
myResult = myPlayer.Name.ToString();
}
}
return myResult;
}
public
RadDocument ImportWordDoc()
{
LoadXML();
using (Stream stream = Application.GetResourceStream(GetResourceUri("NEW.docx")).Stream)
{
Document.LayoutMode =
DocumentLayoutMode.Flow;
Document =
new DocxFormatProvider().Import(stream);
}
foreach (Inline varInline in Document.EnumerateChildrenOfType<Inline>())
{
if (varInline.GetType().ToString().Equals("Telerik.Windows.Documents.Model.Span"))
{
((
Span)varInline).Text = GetActualValue(((Span)varInline).Text, Players);
//Span mySpan = new Span(GetActualValue(((Span)varInline).Text, Players));
// Document.Children.AddAfter(varInline, mySpan);
//bool isRemoved = Document.Children.Remove(varInline);
}
}
Document;
}