This forum is intended for cases when a problem can not be solved due to restrictions of the platform: a bug or lack of functionality.

#1
People who like this: 0 Yes / 0 No
Just came
Rating: 0
Joined: Sep 19, 2014
Company: FirstBit Dubai

Hello!
The configuration uses multiple languages. You need to add the ability for the user to generate reports in the DCS in the selected language. In this case, the report generation language will differ from the current configuration and user language.

Using the LanguageCode property for a SpreadsheetDocument does not produce the desired results.
Is it technically possible for the platform to implement this requirement?
Platform version 8.3.17

 
#2
People who like this: 0 Yes / 0 No
Administrator
Rating: 29
Joined: Oct 3, 2019
Company:

Hello Igor,

in this case, you can make several DataCompositionSchemas (DCS) in one report, each language has its own DCS. And already when generating a report, depending on the language chosen by the user, generate the necessary data.

Please see screenshots and source code below. I also attached a sample of the simplest report with a choice of languages.


Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   
   StandardProcessing = False;

   If language Then 
        SchemeDataComposition = GetTemplate("DataCompositionSchema_en");
    Else 
        SchemeDataComposition = GetTemplate("DataCompositionSchema_ru");
    EndIf;

    Settings = SettingsComposer.GetSettings();
    
    TemplateComposer       = New DataCompositionTemplateComposer;
    TemplateComposition    = TemplateComposer.Execute(SchemeDataComposition, Settings, DetailsData);
    CompositionProcessor   = New DataCompositionProcessor;
   
   CompositionProcessor.Initialize(TemplateComposition, , DetailsData);
   
   OutputProcessor = New DataCompositionResultSpreadsheetDocumentOutputProcessor;
   
   OutputProcessor.SetDocument(ResultDocument);
    OutputProcessor.Output(CompositionProcessor);   
   
EndProcedure

 
#3
People who like this: 0 Yes / 0 No
Administrator
Rating: 29
Joined: Oct 3, 2019
Company:

Hello Igor,

no such problem was found on the 8.3.17.1549 platform. Please clarify in what configuration you're working? Also please email a sample source code where the error occurs.

Best regards,
Aleksandr

 
#4
People who like this: 0 Yes / 0 No
Just came
Rating: 0
Joined: Sep 19, 2014
Company: FirstBit Dubai

I create new configuration at platform 8.3.17.1549
Add objects:
- two languages
- one catalog
- one report

I add this code in object module in report

Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   ResultDocument.LanguageCode = "ru";
EndProcedure


As a result, I don't get russian headers under english user.
What am I doing wrong?

 
#5
People who like this: 0 Yes / 0 No
Just came
Rating: 0
Joined: Sep 19, 2014
Company: FirstBit Dubai

If I add this code, I don't get result

Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   
   ResultDocument.LanguageCode = "ru";
   
   StandardProcessing = False;
   
   Settings = ThisObject.SettingsComposer.GetSettings();
   UserSettings = ThisObject.SettingsComposer.UserSettings;
   
   TemplateComposer = New DataCompositionTemplateComposer;
   CompositionTemplate = TemplateComposer.Execute(ThisObject.DataCompositionSchema, Settings, DetailsData);
   
   CompositionProcessor = New DataCompositionProcessor;
   CompositionProcessor.Initialize(CompositionTemplate,, DetailsData, True);
   
   OutputProcessor = New DataCompositionResultSpreadsheetDocumentOutputProcessor;
   OutputProcessor.SetDocument(ResultDocument);
   
   OutputProcessor.BeginOutput();
   
   ResultItem = CompositionProcessor.Next();
   While ResultItem <> Undefined Do
      OutputProcessor.OutputItem(ResultItem);
      ResultItem = CompositionProcessor.Next();
   EndDo;

   OutputProcessor.EndOutput();
   
   ResultDocument.LanguageCode = "ru";
   
EndProcedure


Under the English user, I still get English headers
And only russian user, I get russian headers

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.

/* --- ФИКС ЗАГОЛОВКОВ ДОКУМЕНТАЦИИ (BRUTE FORCE) --- */ /* Цепляемся за все возможные контейнеры Битрикса */ .content h1, #content h1, .workarea h1, .content h2, #content h2, .workarea h2, .content h3, #content h3, .workarea h3, .content h4, #content h4, .workarea h4, .content h5, #content h5, .workarea h5, .content h6, #content h6, .workarea h6 { display: block !important; font-weight: 700 !important; color: #222 !important; text-transform: none !important; margin-top: 1.5em !important; margin-bottom: 0.5em !important; line-height: 1.2 !important; } /* Явно задаем размеры, чтобы перекрыть "font-size: 100%" */ .content h1, #content h1 { font-size: 28px !important; } .content h2, #content h2 { font-size: 24px !important; } .content h3, #content h3 { font-size: 22px !important; } .content h4, #content h4 { font-size: 20px !important; } .content h5, #content h5 { font-size: 18px !important; } /* Ваш случай (5 решеток) */ .content h6, #content h6 { font-size: 16px !important; } /* Если Битрикс или редактор засунули внутрь h5 тег span или font */ .content h5 *, #content h5 *, .workarea h5 * { font-size: inherit !important; color: inherit !important; font-weight: inherit !important; } /* --- СТИЛИЗАЦИЯ ТЕКСТА (Markdown Style) --- */ /* Ссылки в тексте делаем более заметными */ .content a:not([class]) { color: #005aa0; text-decoration: none; border-bottom: 1px solid rgba(0, 90, 160, 0.2); } .content a:not([class]):hover { border-bottom-color: #005aa0; } /* Списки (чтобы не прилипали) */ .content ul, .content ol { margin-bottom: 15px !important; padding-left: 20px !important; } .content li { margin-bottom: 5px !important; }