Mas

Mas

  • NA
  • 473
  • 65.5k

At the special characters we are getting ? mark

Jan 30 2020 7:57 PM
Hello All,
 
Hope you are doing good!!
 
How can we remove the ? at the special charterers from the preview of document..
 
Here we are converting the file to HTML and using the microsoft interop we are previewing the file..
 
Here am  adding the code and screenshot issues.
  1.  public partial class Default : System.Web.UI.Page  
  2. {  
  3. protected void Page_Load(object sender, EventArgs e)  
  4. {  
  5. string res_url = "https://s3-us-west-2.amazonaws.com/talpal/candidate_resume/52935_1530807980AnilKumar-Sr.devops.docx";  
  6. show_resume(res_url);  
  7. }  
  8. public void show_resume(string resume_url)  
  9. {  
  10. object documentFormat = 8;  
  11. string randomName = DateTime.Now.Ticks.ToString();  
  12. object htmlFilePath = Server.MapPath("~/Temp/") + randomName + ".htm";  
  13. string directoryPath = Server.MapPath("~/Temp/") + randomName + "_files";  
  14. object fileSavePath = Server.MapPath("~/Temp/") + Path.GetFileName(resume_url);  
  15. string extension = Path.GetExtension(resume_url).ToLower();  
  16. if (extension == ".pdf")  
  17. {  
  18. resume_viewer.Src = "doc Path";  
  19. }  
  20. else  
  21. {  
  22. //If Directory not present, create it.  
  23. if (!Directory.Exists(Server.MapPath("~/Temp/")))  
  24. {  
  25. Directory.CreateDirectory(Server.MapPath("~/Temp/"));  
  26. }  
  27. // Create a new WebClient instance.  
  28. using (WebClient myWebClient = new WebClient())  
  29. {  
  30. // Download the Web resource and save it into the current filesystem folder.  
  31. myWebClient.DownloadFile(resume_url, fileSavePath.ToString());  
  32. }  
  33. //Open the word document in background.  
  34. _Application applicationclass = new Microsoft.Office.Interop.Word.Application();  
  35. applicationclass.Documents.Open(ref fileSavePath);  
  36. applicationclass.Visible = false;  
  37. Document document = applicationclass.ActiveDocument;  
  38. //Save the word document as HTML file.  
  39. document.SaveAs(ref htmlFilePath, ref documentFormat);  
  40. //Close the word document.  
  41. document.Close();  
  42. //Read the saved Html File.  
  43. string wordHTML = System.IO.File.ReadAllText(htmlFilePath.ToString(), System.Text.Encoding.ASCII);  
  44. /* using (FileStream fs = File.Open(htmlFilePath.ToString(), FileMode.Open, FileAccess.ReadWrite)) 
  45. { 
  46. using (StreamReader sr = new StreamReader(fs)) 
  47. { 
  48. wordHTML = sr.ReadToEnd(); 
  49. } 
  50. }*/  
  51. // dvWord.InnerHtml = wordHTML;  
  52. System.Data.DataTable dtjd = (System.Data.DataTable)Session["jd_cand_details"];  
  53. string mandatory_skills = "html,javascript,java,.net";  
  54. string[] arrskills = mandatory_skills.Split(',');  
  55. for (int i = 0; i < arrskills.Length; i++)  
  56. {  
  57. TextInfo myTI = new CultureInfo("en-US"false).TextInfo;  
  58. string skill_lower = myTI.ToLower(arrskills[i]);  
  59. string skill_upper = myTI.ToUpper(arrskills[i]);  
  60. string skill_title_case = myTI.ToTitleCase(arrskills[i]);  
  61. string strhtml = wordHTML.Trim();  
  62. // string lowerhtml = wordHTML.ToLower();  
  63. // < font style = "background-color:yellow" >  
  64. wordHTML = wordHTML.Replace(skill_lower.Trim(), "" + skill_lower + "");  
  65. wordHTML = wordHTML.Replace(skill_upper.Trim(), "" + skill_upper + "");  
  66. wordHTML = wordHTML.Replace(skill_title_case.Trim(), "" + skill_title_case + "");  
  67. }  
  68. System.IO.File.WriteAllText(htmlFilePath.ToString(), wordHTML, System.Text.Encoding.ASCII);  
  69. string filename = "http://localhost:61950/Temp/" + randomName + ".htm";  
  70. resume_viewer.Src = filename;  
  71. }  
  72. }  
  73. }  

  1.  .wrap  
  2. {  
  3. width500px;  
  4. height750px;  
  5. padding0;  
  6. overflowhidden;  
  7. }  
  8. .frame  
  9. {  
  10. width650px;  
  11. height750px;  
  12. border0;  
  13. -ms-transform: scale(0.75);  
  14. -moz-transform: scale(0.75);  
  15. -o-transform: scale(0.75);  
  16. -webkit-transform: scale(0.75);  
  17. transform: scale(0.75);  
  18. -ms-transform-origin: 0 0;  
  19. -moz-transform-origin: 0 0;  
  20. -o-transform-origin: 0 0;  
  21. -webkit-transform-origin: 0 0;  
  22. transform-origin: 0 0;  


Answers (2)