简体   繁体   English

如何以原始形式将文本从 docx 输入到 Android Studio?

[英]How to input text from docx to Android Studio in its original form?

I am making a simple android app(in Android Studio) and one of the parts of the app requires showing text that I wrote in docx.我正在制作一个简单的 android 应用程序(在 Android Studio 中),应用程序的一个部分需要显示我在 docx 中编写的文本。 When I paste my text in a textView, all my new lines are gone, I'm left with text as If I was typing it in a notepad.当我将文本粘贴到 textView 中时,所有新行都消失了,剩下的文本就像在记事本中键入一样。

How can I import text and maintain it's original form?如何导入文本并保持其原始形式? (It wouldn't be a problem if it was one smaller text, but there's a lot of it and manualy correcting it would take a lot of time,and it's not really efficient) (如果它是一个较小的文本不会有问题,但是有很多并且手动更正它会花费很多时间,而且效率不高)

它在 docx 中的外观(示例文本)

它在 android studio 中的外观

Using Word seems like the wrong approach to me, but the textview supports html, which should be suffient for your example:使用 Word 对我来说似乎是错误的方法,但 textview 支持 html,这应该足以满足您的示例:

textView.setText(Html.fromHtml("
Lorem ..<br\> 
Lorem ...<br\> 
<ol>
   <li>Lorem ...</li>
   <li>LOREM ...</li>
</ol>", Html.FROM_HTML_MODE_COMPACT));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Java / Android Studio中使Imagebutton更改Image onClick in,并在ClickOut上返回其原始图像 - How to make an Imagebutton change Image onClick in and Back to its original on ClickOut in Java/Android Studio 如何在Android Studio中粘贴没有格式化的格式化文本? - How to paste a formatted text without its formatting in Android Studio? Android Studio:如何从活动获取用户输入(从微调器和编辑文本)到另一个活动? - Android Studio: How do I get user input (From Spinner and Edit Text) from activity to another activity? 如何按原样从DOCX获取所有文本 - How to fetch all text from the DOCX as-is 如何从.docx文件中提取编号和文本 - How to extract numbering and text from .docx file 如何使用Tika从docx中提取文本 - How to extract text from docx with Tika 如何在docx文档中创建复选框并输入文本字段? - How to create checkbox and input text fields in docx document? 通过自定义原始类的自定义android AnalogClock设置时间 - Set time with custom android AnalogClock from its original class 如何将纯文本中的文本设置为字符串(Android Studio) - How to make the text from a Plain Text a String(Android Studio) 将用户输入保存到文本文件android studio - Saving user input to text file, android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM