Code Monkey home page Code Monkey logo

aspose.words-for-java's People

Contributors

adam-skelton avatar adeelilyas2014 avatar ali-salman avatar aspose-words-gists avatar awaishafeez avatar fahadadeel avatar falleretic avatar farooqsheikhpk avatar fatimaahmed avatar masood-anwer avatar msohailismail avatar muhammad-ijaz avatar muzammil-khan avatar naeem244 avatar rizwanniazigroupdocs avatar saqib-razzaq-aspose avatar saqibmasood avatar saqibrazzaq avatar saudaspose avatar sdfleod avatar shahzad-latif avatar shoaibkhan-aspose avatar sohail-aspose avatar tahir-manzoor avatar tilalahmad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aspose.words-for-java's Issues

How to replace {excel} with 1.xlsx embeding in word?

I want to replace {excel} with 1.xlsx embeding in input.docx and save it as output.docx.
However the following code can only embed 1.xlsx to the beginning of input.docx.
What should I do to replace {excel} tag with 1.xlsx?

input.docx I got
image

output.docx which I want
image

output.docx which I actually got
image

import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;


public class Aspose 
{
    public static void main( String[] args ) throws Exception
    {
            try {
		        Document doc = new Document("E:/workspace/Aspose/input.docx");
	                DocumentBuilder builder = new DocumentBuilder(doc);
	                builder.insertOleObject("E:/workspace/Aspose/1.xlsx", "xlsx", false, true, null);
	                doc.save("E:/workspace/Aspose/" + "output.docx");
                } catch (Exception e) {
                        e.printStackTrace();
                }
    }
}

org.apache.tomcat.util.bcel.classfile.ClassFormatException:Invalid byte tag in constant pool: 19

my app deploy in Tomcat8.5.2 and jdk1.8.And I through Maven dependency aspose-words-19.6-jdk17.jar.
when i startup tomcat,it throw Exception:

08-Jul-2019 08:40:01.372 SEVERE [localhost-startStop-1] org.apache.catalina.startup.ContextConfig.processAnnotationsJar Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [file:/D:/apache-tomcat-8.5.2/webapps/ROOT/WEB-INF/lib/aspose-words-19.6-jdk17.jar] for annotations
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19
         at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:97)
         at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:54)
         at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:174)
         at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:83)
         at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2042)
         at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1989)
         at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1959)
         at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1912)
         at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1154)
         at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
         at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:298)
         at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
         at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5093)
         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
         at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1405)
         at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1395)
         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
         at java.lang.Thread.run(Thread.java:748)

Create document via inputstream results in blank page

I saved my docx documents temporarily as blob in a postgresql database using jdbc. After fetching and initializing them with help of the Document::constructor (Aspose 19.10) all of the created documents are blank.

Example code

List<Document> test(List<InputStream> streams) {
   List<Document> a = new LinkedList<>();
   for(InputStream stream: streams) {
      a.add(new Document(stream);
   }
   return a;
}

The cause

The Document::constructor for inputstreams calls zz51.zzY(stream) and this method contains the following lines:

if (var0 instanceof FileInputStream) {
    return new zz1K((FileInputStream)var0);
}
if (var0.markSupported()) {
    return new zz1J(var0);
}

return zzX(var0);

My InputStream isn't of type FileInputStream but it supports marks and in my case it jumps into zz1J. The following snipped is the cause of my blank documents:

this.zzSv = (long)var1.available();
this.zz2Y = false;
this.zz2Z.mark((int)this.zzSv);

According the official javadoc its not recommended to do that (Javadoc InputStream) because "some implementations of InputStream will return the total number of bytes in the stream, many will not". So doesn't the BlobInputStream of the Postgresql-jdbc implementation which returns the default value of InputStream::available (Postgresql BlobInputStream).

Solution/Workaround

My workaround is to wrap the InputStream into a class that extands from InputStream and override the methods returning false in the method markSupported to skip the jump into zz1J. Instead it reads the stream as it is in zzX.

br

Getting only 198 Rows and 198 Cells in MS Word Table by using aspose word library in JAVA

int totalRow = doc.getChildNodes(NodeType.ROW, true).getCount();
System.out.println("Total Row : " + totalRow);

Getting 198 Rows but i have more then 198 rows in MS Word Table

OR

int totalCellMethod = doc.getChildNodes(NodeType.CELL, true).getCount();
System.out.println("Total CELL : " + totalCellMethod);

Getting 198 Cells but i have more CELL in MS Word Table

Insert html to Word,html forrmat is

I want to convert HTML to doc format, but I find that the style doesn't work, including setting the line spacing of paragraphs
code example:
image

but in fact:
image

Non-configurable setting in Aspose_Words_Java_for_Ruby

I'm trying to use asposewordsjavaforruby with the Aspose Words for Java.

In the file:

Aspose.Words-for-Java/Plugins/Aspose_Words_Java_for_Ruby/lib/asposewordsjavaforruby.rb

I see the following line:

license = Rjb::import('com.aspose.api.License').new()

Doesn't integrate with correctly load the license file, I had to change it to:

license = Rjb::import('com.aspose.words.License').new()

Is this the correct?

Please advise.

Do you have support for adding dynamic WebExtension element nodes in Word Document?

I have requirement where I need to add Web Extension properties to the document dynamically when it downloaded from application, below is the sample webextension xml that I need to add.

<we:webextension xmlns:we="http://schemas.microsoft.com/office/webextensions/webextension/2010/11" id="{52811C31-4593-43B8-A697-EB873422D156}">
    <we:reference id="af8fa5ba-4010-4bcc-9e03-a91ddadf6dd3" version="1.0.0.0" store="EXCatalog" storeType="EXCatalog"/>
    <we:alternateReferences/>
    <we:properties/>
    <we:bindings/>
    <we:snapshot xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/>
</we:webextension>

I have gone through your API Documentation and examples and did'nt find any thing related to adding Web Extension properties to the Document, but I found that we can add to the Excel Workbook from below link.
https://docs.aspose.com/display/cellsjava/Web+Extensions+-+Office+Add-ins#WebExtensions-OfficeAdd-ins-SampleCode

Would you please confirm that you have support for Word document as well? If so, could you please provide me sample code or the steps to achieve this requirement.

DocumentPreviewAndPrint not finished ?

Does not work for me.

Exception in thread "main" java.awt.IllegalComponentStateException: contentPane cannot be set to null.
at javax.swing.JRootPane.setContentPane(JRootPane.java:620)
at javax.swing.JFrame.setContentPane(JFrame.java:693)
at com.aspose.words.examples.rendering_printing.PrintPreviewDialog.init(PrintPreviewDialog.java:106)
at com.aspose.words.examples.rendering_printing.PrintPreviewDialog.(PrintPreviewDialog.java:91)
at com.aspose.words.examples.rendering_printing.DocumentPreviewAndPrint.main(DocumentPreviewAndPrint.java:49)

Examples cannot be executed

I checked out the repository and imported the project as described in http://www.aspose.com/docs/display/wordsjava/How+to+Run+the+Examples to Intellij.

When I try to start any of these examples, I get an error in BuildTableFromDataTable.java in line 33:

		// Retrieve the data from our data source which is stored as a DataTable.
		DataTable dataTable = getEmployees(databaseDir);

This seems to be a not defined static function with a variable wich is not defined anywhere, too. A full-text-search in the whole project does not find any declaration.

Are there some installation-steps missing or is it a bug? Or do I need code from additional repositories?

更改柱状图颜色

你好,ApiExample里Data的ReportingEngine.SetPointColorDinamically Gold.docx文档是怎么实现的,没有找到相应的实现程序

builder.insertChart() How can set different colors

The sample code

public void HideChartAxis(String dataDir) throws Exception
{
    // ExStart:HideChartAxis
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);

    Shape shape = builder.insertChart(ChartType.COLUMN, 432, 252);
    Chart chart = shape.getChart();

    // Clear the chart's demo data series to start with a clean chart.
    chart.getSeries().clear();

    // Add a custom series with categories for the X-axis, and respective decimal values for the Y-axis.
    chart.getSeries().add("AW Series 1",
            new String[]{"Item 1", "Item 2", "Item 3", "Item 4", "Item 5"},
            new double[]{1.2, 0.3, 2.1, 2.9, 4.2});

    // Hide the axis
    chart.getAxisY().setHidden(true);

    dataDir = dataDir + "HideChartAxis_out.docx";
    doc.save(dataDir);
    //ExEnd:HideChartAxis
    System.out.println("\nY Axis of chart has been hidden successfully. \nFile saved at " + dataDir);
}

like this
image

how to set different colors
image

word coverts to pdf table style is wrong

word table
image

convert to pdf

image

the table got narrower.
aspose-words version 19.1 and 19.10

word转换成pdf之后,个别表格宽度变窄,在windows下用office转换成pdf,是正常的。
而且很奇怪的一点是,我随便将word增删一些文字之后,再次转换就正常了。

Cannot find FindReplaceOptions class

Hello guys,
I'm trying to execute this example

The problem is that classes FindReplaceOptions and FindReplaceDirection are absent from com.aspose.words package.

The version of the jar I use is aspose-words-16.6.0-jdk16.jar

Is that something that expected and example should be updated?

Thanks.

aspose word转pdf linux系统上很慢

同样的代码和word文件,在windows 讲word转成pdf只需要2s左右,在linux上需要200s。请问aspose是不是用了windows上某些库?

Word to PDF function, some rare words are missing(Chinese)

When word typesetting is full of many rare words (normal display in word), some rare words will lose the display blank when wrapping. Two fonts, Song typeface and founder typeface, were used, and the test results were the same.

The test has found many times that what is missing is not a specific word, but according to the different typesetting of the word. For example, the order of the generated word changes. After each conversion, the generated PDF file will be missing different words. The loss is the same when tested with Song typeface and founder font, and other words are missing when tested with Microsoft YaHei.

Use WPS software to test the conversion (at this time, the word typesetting font has been preset in Song typeface or founder). The converted PDF displays normally without word loss

[the corresponding font directory has been specified in the program, and the default font when the program cannot find the corresponding font has also been set, but the conversion of rare words still has the problem of missing words. Is this a current bug? Or what caused it? Please answer them.

Some codes are as follows:

`
/**
* Generate PDF specified font source directory
* @param fontFloder
*/
private static void settingFont(Document doc, String fontFloder) throws Exception {
FontSettings.getDefaultInstance().setFontsFolder(fontFloder, true);
FontSettings fontSettings = FontSettings.getDefaultInstance();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("SimSun-ExtB");
// fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("FZSongS-Extended(SIP)");
fontSettings.setFontsSources(
new FontSourceBase[] { new FolderFontSource(fontFloder, true) });
fontSettings.getSubstitutionSettings().getFontConfigSubstitution().setEnabled(false);
fontSettings.getSubstitutionSettings().getTableSubstitution().setEnabled(false);
fontSettings.getSubstitutionSettings().getFontInfoSubstitution().setEnabled(false);
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setEnabled(true);
System.out.println(fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().getDefaultFontName());
ArrayList availableFonts = fontSettings.getFontsSources()[0].getAvailableFonts();
System.out.println("availableFonts ===start");
for(PhysicalFontInfo physicalFontInfo : availableFonts){
System.out.println("FullFontName ==="+physicalFontInfo.getFullFontName());
}
System.out.println("availableFonts ===end");
System.out.println("systemFontFolder ===start");
for (String systemFontFolder : SystemFontSource.getSystemFontFolders()) {
System.out.println(systemFontFolder);
}
System.out.println("systemFontFolder ===end");
IWarningCallback ck = info -> {
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
System.out.println("Font substitution: " + info.getDescription());
}
};
doc.setWarningCallback(ck);
doc.setFontSettings(fontSettings);
}

//Conversion statement
Document doc = null;
FileOutputStream fos = new FileOutputStream(file);
doc.save(fos, SaveFormat.DOCX);
`

生僻字整体排版如下:
𪾢𫓯𬷕𫷷亍𪾢尢𪾢彳𫓯卬𫓯殳𬷕𠙶𬷕毌𫷷邘𫷷戋圢氕伋仝冮氿汈氾忉宄𬣙讱扞圲圫芏芃朳朸𨙸邨吒吖屼屾辿钆仳伣伈癿甪邠犴冱邡闫𬇕汋䜣讻𬣞孖𬘓纩玒玓玘玚刬𫭟坜坉扽𫭢坋扺㧑毐芰芣苊苉芘芴芠𫇭芤杕杙杄杧杩尪尨轪𫐄坒芈旴旵呙㕮岍𫵷岠岜呇冏觃岙伾㑇伭佖伲佁飏狃闶汧汫𣲘𣲗沄沘𬇙汭㳇沇忮忳忺𬣡祃诇邲诎诐屃𫸩岊阽䢺阼妧妘𨚕纮驲𫘜纻𬘘𫘝纼玤玞玱玟邽邿坥坰坬坽弆耵䢼𦭜茋苧苾苠枅㭎枘枍矼矻匼𬨂𬀩𬀪旿昇昄昒昈咉咇咍岵岽岨岞峂㟃囷𬬩钐钔钖牥佴垈侁侹佸佺隹㑊侂佽侘郈舠郐郃攽肭肸肷狉狝饳忞於炌炆泙沺泂泜泃泇怊峃穸祋祊𫍣𬣳𬩽鸤弢弨陑𬮿陎𬯀卺乸妭姈𫰛迳叕𬳵驵𬳶䌹驺𫠊绋绐砉耔㛃玶珇珅𬍛珋玹珌玿韨垚垯垙垲埏垍耇鿍垎垴垟垞挓垵垏拶荖荁荙荛茈茽荄茺𬜬荓茳𦰡茛荭㭕柷柃柊枹栐柖郚剅䴓迺厖砆砑砄耏奓䶮轵轷轹轺昺𪾢昽盷咡咺昳昣哒昤昫昡咥昪虷虸哃峘耑峛𪨰峗峧帡钘𫓧钜𬬮𬬱𬬭钪钬钭矧秬俫舁俜俙俍垕衎舣弇侴鸧䏡胠𦙶胈胩胣朏飐訄饻庤疢炣炟㶲洭洘洓洿㳚泚浈浉洸洑洢洈洚洺洨浐㳘洴洣恔宬窀扂袆祏祐祕叚陧陞娀姞姱姤姶姽枲绖骃𬘡𬳽𬘩𫄧彖骉恝珪珛珹琊玼珖𪟝珽珦珫珒𬍤珢珕珝𫭼埗垾垺埆垿埌埇莰茝𬜯鄀莶莝䓖莙栻桠𬂩桄梠栴梴栒酎酏𫠆砵砠砫砬硁恧翃郪𨐈辀辁𬌗剕赀哢晅晊唝哳哱冔晔晐晖畖蚄蚆𫑡帱崁峿𪨶崄帨崀赆𬬸钷𬬻𬬹𬬿𬭁眚甡笫倻倴脩倮倕倞𫢸倓倧衃虒舭舯舥瓞鬯鸰脎朓胲虓鱽狴峱狻眢𫗧勍痄疰痃竘羖羓桊敉烠烔烶烻𬊈涍浡浭浬涄涢涐浰浟浛浼浲涘悈悃悢𬒈宧窅窊窎扅扆袪袗袯祧隺堲疍𨺙陴烝砮㛚哿翀翂剟𬳿𫄨绤骍𬘫䂮琎珸珵琄琈琀珺掭堎堐埼掎埫堌晢𫮃掞埪壸㙍聍菝萚菥莿䓫勚䓬萆菂菍菼萣䓨菉䓛梼梽桲梾桯梣梌桹敔厣硔鿎硙硚硊硍勔䴕龁逴唪啫翈㫰晙畤𬱖趼跂蛃蚲𬟽蚺啴䎃崧崟崞崒崌崡铏𫓯𫟹铕𫟼铖铘铚铞铥铴牻牿稆笱笯偰偡鸺偭偲偁㿠鄅偓徛衒舳舲鸼悆鄃瓻䝙脶脞脟䏲鱾猇猊猄觖𠅤庱庼庳痓䴔竫堃阌羝羕焆烺焌淏𬇹淟淜淴淯湴涴𬍡㥄惛惔悰惙寁逭𬤇𫍯袼裈祲𬤊𫍲谞艴弸弶𬯎隃婞娵婼媖婳婍婌婫婤婘婠𬘬𬘭𬴂𫘦绹𫟅𬘯骕𫘧絜珷琲琡琟琔琭堾堼揕㙘堧喆堨塅堠絷𪣻𡎚葜惎萳葙靬葴蒇蒈鄚蒉蓇萩蒐葰葎鄑蒎葖蒄萹棤棽棫椓椑𬃊鹀椆棓棬棪椀楗𬷕甦酦觌奡皕硪欹詟𫐐辌棐龂𬹼黹牚睎晫晪晱𧿹蛑畯斝喤崶嵁𫶇崾嵅崿嵚翙𫖮圌圐赑淼赒鿏铹𬭊铽𨱇𫓶锊锍锎𬭎锓犇颋稌筀筘筜筥筅傃傉翛傒傕舾畬𫖯脿腘䐃腙腒𬱟鲃猰𫛭猯㺄馉凓鄗𫷷廋廆鄌粢遆旐𬮱焞𬊤欻𣸣溚溁湝渰湓㴔渟溠渼溇湣湑溞愐愃敩甯棨扊裣祼婻媆媞㛹媓媂媄毵矞𬴃𫘨缊缐骙瑃瑓瑅瑆䴖瑖瑝瑔瑀𤧛瑳瑂嶅瑑遘髢塥堽赪摛塝搒搌蒱蒨蓏蔀蓢蓂蒻蓣椹楪榃榅楒楞楩榇椸楙歅𬪩碃碏𬒔碈䃅硿鄠辒𬨎𫐓龆觜䣘暕鹍𫫇㬊暅跱蜐蜎嵲赗骱锖𫓹锘锳锧锪𬭚锫锬𬭛稑稙䅟𬕂筻筼筶筦筤傺鹎僇艅艉谼貆腽腨腯鲉鲊鲌䲟𬶋𬶍鲏雊猺飔觟𦝼馌裛廒瘀瘅鄘鹒鄜麀鄣阘𫔶煁煃煴煋煟煓滠溍溹滆滉溦溵漷滧滘滍愭慥慆塱𫌀裼禋禔禘禒谫鹔𫖳愍嫄媱戤勠戣𫘪𫘬缞耤瑧𫞩瑨瑱瑷瑢斠摏墕墈墐墘摴銎𡐓墚撖𪤗靽鞁蔌蔈蓰蔹蔊嘏榰榑槚𣗋槜榍疐𬸘酺酾酲酴碶䃎𬒗碨𥔲碹碥劂𫚖䴗夥瞍鹖㬎跽蜾幖嶍圙𨱏锺锼锽𬭤锾锿镃镄镅馝鹙箨箖劄僬僦僔僎槃㙦鲒鲕𫚕鲖鲗鲘鲙𬶐𬶏𩽾夐獍飗𬸚凘廑廙瘗瘥瘕鲝鄫熇漹漖潆漤潩漼漴㽏漈漋漻慬窬窭㮾𬤝褕禛禚隩嫕嫭嫜嫪𬙂㻬麹璆漦叇墣墦墡劐薁蕰蔃鼒槱鹝磏磉殣慭霅暵暲暶踦踣䗖蝘蝲蝤噇噂噀罶嶲嶓㠇嶟嶒镆镈镋镎𬭩镕稹儇皞皛䴘艎艏鹟𩾃鲦鲪鲬橥觭鹠鹡糇糈翦鹢鹣熛潖潵㵐澂澛瑬潽潾潏憭憕𬸣戭褯禤𫍽嫽遹𬴊璥璲璒憙擐鄹薳鞔黇𬞟蕗薢蕹橞橑橦醑觱磡𥕢磜豮𫟦𬺈𫠜鹾虤暿曌曈㬚蹅踶䗛螗疁㠓幪𪩘嶦𬭬𨱑𬭯馞穄篚篯簉鼽衠盦螣縢鲭鲯鲰鲺鲹𫗴亸癀瘭𬸦羱糒燋熻燊燚燏濩濋澪澽澴澭澼憷憺懔黉嬛鹨翯𫄷璱𤩽璬璮髽擿薿薸檑櫆檞醨繄磹磻瞫瞵蹐蟏㘎𬭳镤𬭶𫔍镥镨𬭸𨱔𬭼𫔎矰穙穜穟簕簃簏儦魋斶艚𬸪谿䲠𬶟鲾𬶠鲿鳁鳂鳈鳉獯䗪馘襕襚𬶨螱甓嬬嬥𦈡𫄸瓀釐鬶爇鞳鞮𬟁藟藦藨鹲檫黡礞礌𥖨蹢蹜蟫䗴嚚髃镮镱酂馧簠簝簰鼫鼩皦臑䲢鳑鳒鹱鹯癗𦒍旞翷冁䎖瀔瀍瀌襜䴙𬙊嚭㰀鬷醭蹯蠋翾鳘儳儴鼗𬶭𩾌鳚鳛麑麖蠃彟嬿鬒蘘欂醵颥甗𨟠巇酅髎犨𬶮𨭉㸌爔瀱瀹瀼瀵襫孅骦𬙋耰𤫉瓖鬘趯𬺓罍鼱鳠鳡鳣爟爚灈韂糵蘼礵鹴躔皭龢鳤亹籥鼷𫚭玃醾齇觿蠼

请问解析word的时候,发现有一些图片在调用remove的时候没有删除当前图片

        NodeCollection shapeCollection  = doc.getChildNodes(NodeType.DRAWING_ML, true);
        for (int i=0; i<shapeCollection.getCount(); i++) {
            DrawingML drawingML = (DrawingML) shapeCollection.get(i);
            if(drawingML.hasImage()) {
                  String imageFileName = java.text.MessageFormat.format(
                        "Image.ExportImages.{0} Out{1}", i, FileFormatUtil.imageTypeToExtension(drawingML.getImageData().getImageType()));
                  DrawingMLImageData imageData = drawingML.getImageData();
                  imageData.save("D:\\company\\pic\\" + imageFileName);
                drawingML.remove(); // There are some images that are not effective
            }
        }

Html processing question.

你好:

我这里有几个问题:

  1. 我在html中存在有外联CSS和JS文件,生成word时候我的样式丢失了,怎么处理呢?
  2. 图片可能是相对引用的路径,如果是存在的网络资源如何更好的处理?
    目前就css样式我是使用<style>写入到html中,图片是通过将图片转base64之后替换原有src属性值
    感谢您在百忙之中查阅!

Originally posted by @WEIQ311 in #44 (comment)

UpdateFields BUG

I call the method getMailMerge().execute() after updateFields, then it comes a bug like this
demo1
demo2

        String resourceWordPath = "demo.docx";
        String targetWordPath = "demo1.docx";
        try {
            WordToPdfUtils.getLicense();
            Document doc = new Document(resourceWordPath);
            doc.getMailMerge().execute(new String[]{"name"}, new String[]{"111"});
            doc.updateFields();
            doc.save(targetWordPath);
        } catch (Exception e) {
            e.printStackTrace();
        }

word 转 pdf 绘图工具所做的 图片丢失 着重号丢失

image
丢失部分是绘图工具 所绘制的图片 直接引入的图片 是没有问题的
Document doc = new Document(inPath); // Address是将要被转化的word文档 doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
a.docx
image
着重号问题丢失
image

因为所用到的word 文档比较复杂 这里转换 成pdf 或者 图片 都会出现上述问题

Create Document via input stream results in blank saved document

I just spent ages trying to work out why my DOCX --> PDF files were ending up blank.

InputStream fileStream = new FileInputStream(fileToConvert);
Document doc = new Document(fileStream);
doc.save(targetFile.getAbsolutePath(), SaveFormat.PDF);

Results in blank document

Document doc = new Document(fileToConvert.getAbsolutePath());
doc.save(targetFile.getAbsolutePath(), SaveFormat.PDF);

Works

No errors, nothing to suggest the former wouldn't work, it just creates a blank document.

Grrr.

(I had the filestream as I needed that to be able to use your FileFormatInfo to throw an encrypted error for encrypted files, and figured as I had it I may as well give it to the document constructor)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.