View Full Version : کمک برای یک کتابخانه برای آندروید
imans100
سه شنبه 10 اسفند 1395, 06:42 صبح
سلام دوستان می خواستم ببینم کسی از دوستان کتابخانه ای برای ساخت فایل ورد (doc) میشناسه که هم رایگان باشه و هم قابلیت find وreplace داشته باشه چون من چیز بدر بخوری نتونستم پیدا کنم در ضمن از کتابخانه word2 java استفاده کردم اما قابلیت find و replace رو نداشت
لطفا کمکم کنید:عصبانی++:
radeon
سه شنبه 10 اسفند 1395, 11:57 صبح
کتابخانه docx4j (http://htmlpreview.github.io/?https://github.com/plutext/docx4j/blob/master/docs/Docx4j_GettingStarted.html)
imans100
چهارشنبه 11 اسفند 1395, 08:14 صبح
کتابخانه docx4j (http://htmlpreview.github.io/?https://github.com/plutext/docx4j/blob/master/docs/Docx4j_GettingStarted.html)
مرسی
اما من از این کتابخانه استفاده میکنم ولی هنگامی که روی گوشی استفاده میکنم فورس کلوز میده .اینم کدها:
package word.ir;
import org.docx4j.Docx4J;
import org.docx4j.openpackaging.exceptions.Docx4JExceptio n;
import org.docx4j.openpackaging.packages.ProtectDocument;
import org.docx4j.openpackaging.packages.WordprocessingML Package;
import org.docx4j.openpackaging.parts.WordprocessingML.Ma inDocumentPart;
import org.docx4j.wml.STDocProtect;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import com.example.word.R;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main );
try {
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();
mdp.addParagraphOfText("hello world");
ProtectDocument protection = new ProtectDocument(wordMLPackage);
protection.restrictEditing(STDocProtect.READ_ONLY, "foobaa");
String filename = Environment.getExternalStorageDirectory().getAbsol utePath() + "/protect.docx";
Docx4J.save(wordMLPackage, new java.io.File(filename), Docx4J.FLAG_SAVE_ZIP_FILE);
} catch (Docx4JException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
-------------------------------------------------------------------------------------------
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.word"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name="word.ir.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.