You just need to install fonts that are used in your document. Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS).
Please remove all old DLLs from your project and disk and add reference to latest DLL.
Please share the PDF files requested in my previous post. Please also execute the code shared in my previous post at Web Server and let us know if you face any missing font notification.
Please share step by step information that you are using to reproduce this issue at our end. Please also share the complete detail of Web Server and operating system detail. We will investigate the issue and provide you more information on it.
Thanks a lot Tahir. Our problem is shorted out.There are some true type fonts are not installed in Web Server. Now we installed those and it is working fine.
We are facing one more problem.
Could you please help how to set “Font Text effects to none” to a word document using Aspose.Words dll.
Please use ParagraphFormat.ClearFormatting method to reset the text formatting to default paragraph formatting.
Please ZIP and attach your input, problematic output and expected output documents along with code example to reproduce your issue at our end. We will investigate the issue and provide you more information on it.
Thank you for your response. We have used ParagraphFormat.ClearFormatting method to reset the text formatting to default paragraph formatting but it is not working.
So, I have given the code in a console application in a zip file with Input, expected output and wrongoutput file.
In console application code the input file path(D:\input.docx) is hard codded in code level. You can change it to your local path.
Please find the below zip files where you can find FontPOC.zip for console application and Files.zip for Input, expected and wrong output files.
In your case, we suggest you please implement IReplacingCallback interface to clear the font formatting of matched node. Please check the following code example. Hope this helps you.
Document document = new Document(MyDir + "input.docx");
var findReplaceOptions = new FindReplaceOptions();
findReplaceOptions.Direction = FindReplaceDirection.Forward;
findReplaceOptions.FindWholeWordsOnly = true;
findReplaceOptions.MatchCase = false;
findReplaceOptions.ApplyFont.Color = System.Drawing.Color.Black;
findReplaceOptions.ApplyFont.Underline = Underline.None;
findReplaceOptions.ApplyFont.TextEffect = TextEffect.None; // we set text effect to none but template applied text effects
findReplaceOptions.ApplyFont.UnderlineColor = System.Drawing.Color.Black;
findReplaceOptions.ApplyFont.StrikeThrough = false;
findReplaceOptions.ApplyFont.DoubleStrikeThrough = false;
findReplaceOptions.ApplyFont.Name = "Times New Roman";
findReplaceOptions.ApplyFont.Size = 14;
findReplaceOptions.ReplacingCallback = new FindAndClearFormatting();
document.Range.Replace("<<MBRNAME>>", "AARON", findReplaceOptions);
document.Save(MyDir + "20.4.docx");
private class FindAndClearFormatting : IReplacingCallback
{
ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)
{
// This is a Run node that contains either the beginning or the complete match.
Node currentNode = e.MatchNode;
// The first (and may be the only) run can contain text before the match,
// In this case it is necessary to split the run.
if (e.MatchOffset > 0)
currentNode = SplitRun((Run)currentNode, e.MatchOffset);
ArrayList runs = new ArrayList();
// Find all runs that contain parts of the match string.
int remainingLength = e.Match.Value.Length;
while (
(remainingLength > 0) &&
(currentNode != null) &&
(currentNode.GetText().Length <= remainingLength))
{
runs.Add(currentNode);
remainingLength = remainingLength - currentNode.GetText().Length;
// Select the next Run node.
// Have to loop because there could be other nodes such as BookmarkStart etc.
do
{
currentNode = currentNode.NextSibling;
}
while ((currentNode != null) && (currentNode.NodeType != NodeType.Run));
}
// Split the last run that contains the match if there is any text left.
if ((currentNode != null) && (remainingLength > 0))
{
SplitRun((Run)currentNode, remainingLength);
runs.Add(currentNode);
}
foreach (Run run in runs)
run.Font.ClearFormatting();
return ReplaceAction.Replace;
}
}
We are facing one of the big problem with one of the word file.
The word file is having 4 images and out of that 3 are visible and one of them is invisible.
Problem:- The invisible image is with 0, 0 dimension. Solution:- We need to remove that invisible or 0,0 dimension image from the word file.
Question:- Is it possible to remove the invisible image from the word file using Aspose.Words 18.5 dll for.NET? If yes, could please share the piece of code with us.
Note:- Please help us ASAP, our code is there in Production.
Please find the attached zip file, where you can file one word file. In the header section, you can find three images visible and one image invisible. You can find invisible image by pressing shift + right arrow in front of first image.